PrtWrite

PrtWrite writes data to the device file identified by hDevice.

Syntax
PrtWrite(hDevice, pvoidData, cData, cWritten);

Parameters

 * hDevice (HFILE) - input
 * The device handle returned by PrtOpen.


 * pvoidData (PVOID) - input
 * A pointer to the data buffer.


 * cData (ULONG) - input
 * The length of the data in bytes.


 * cWritten (PULONG) - input
 * A pointer to a count of bytes actually written to the device.

Return Code

 * rc (ULONG) - returns
 * Return codes.

This function returns the same codes as DosWrite:


 * ERROR_ACCESS_DENIED
 * ERROR_BAD_UNIT
 * ERROR_BROKEN_PIPE
 * ERROR_INVALID_HANDLE
 * ERROR_LOCK_VIOLATION
 * ERROR_NOT_DOS_DISK
 * ERROR_OUT_OF_PAPER
 * ERROR_WRITEFAULT
 * NO_ERROR

Remarks
Some physical device drivers return NO_ERROR even though cWritten is not equal to cData. Presentation drivers should compare cData to cWritten to determine if a request has completed successfully before checking for return codes. To complete the request when cData is not equal to cWritten, the call must be issued after calculating the new starting point (pvoidData = pvoidData+cWritten) and the remaining characters to transfer (cData = cData-cWritten).

Example Code

 * 1) include 

HFILE    hDevice;    /*  The device handle returned by PrtOpen. */ PVOID    pvoidData;  /*  A pointer to the data buffer. */ ULONG    cData;      /*  The length of the data in bytes. */ PULONG   cWritten;   /*  A pointer to a count of bytes actually written to the device. */ ULONG    rc;         /*  Return codes. */

rc = PrtWrite(hDevice, pvoidData, cData, cWritten); 