NWWriteEA
Writes data to an Extended Attribute
#include <nwnamspc.h> #include <nwea.h> or #include <nwcalls.h> N_EXTERN_LIBRARY(NWCCODE) NWWriteEA ( NW_EA_HANDLE N_FAR *EAHandle, nuint32 totalWriteSize, nuint32 bufferSize, const nstr8 N_FAR *buffer, pnuint32 amountWritten);
uses calwin32 Function NWWriteEA (Var EAHandle : NW_EA_HANDLE; totalWriteSize : nuint32; bufferSize : nuint32; buffer : pnuint8; amountWritten : pnuint32 ) : NWCCODE;
These are common return values; see Return Values (Return Values for C) for more information.
If the Extended Attribute does not exist, NWWriteEA attempts to create it.
NWWriteEA returns 0x0000 when there is more data in the Extended Attribute and NWWriteEA needs to be called again. NWWriteEA returns 0x0001 when there is valid data in the buffer but none left in the Extended Attribute.
The NWReadEA function and NWWriteEA can perform multiple actions, such as opening or creating an Extended Attribute and then performing the appropriate function. To properly end NWWriteEA, the NWCloseEA function must be called after the last Read, Write, and/or Find Extended Attribute function.
Extended Attribute values should always be read or written completely. Extended Attributes are not treated like files when transferring. Therefore, partial Reads or Writes are not allowed.
IMPORTANT:If an Extended Attribute is not read or written completely, data past the end of the last Read or Write may be lost!
Before calling NWWriteEA, an application must properly initialize the NW_EA_HANDLE structure to access the Extended Attribute database. An application can initialize the NW_EA_HANDLE structure by calling the NWFindFirstEA, NWFindNextEA, NWGetEAHandleStruct, or NWOpenEA function. The NW_EA_HANDLE structure is for internal use only; do not manipulate it in any way.
For Writes, the bufferSize parameter should be at least 512 bytes. If the bufferSize parameter is less than the totalWriteSize parameter, it must be a multiple of 512.
NWWriteEA writes up to the number of bytes specified by the bufferSize parameter or until the end of the Extended Attribute data, whichever comes first. If the data to be written is larger than the buffer size, NWWriteEA must be called multiple times to write all the data to the Extended Attribute.
An application should complete the entire Write before closing the Extended Attribute.