Jump to content

PrtWrite: Difference between revisions

From EDM2
Created page with "PrtWrite writes data to the device file identified by hDevice. ==Syntax== PrtWrite(hDevice, pvoidData, cData, cWritten); ==Parameters== ; hDevice (HFILE) - input : The de..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
PrtWrite writes data to the device file identified by hDevice.  
PrtWrite writes data to the device file identified by hDevice.


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


==Parameters==
==Parameters==
; hDevice (HFILE) - input  
;hDevice (HFILE) - input: The device handle returned by [[PrtOpen]].
: 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.
; pvoidData (PVOID) - input  
;cWritten (PULONG) - input: A pointer to a count of bytes actually written to the device.
: 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==
==Return Code==
; rc (ULONG) - returns  
;rc (ULONG) - returns: Return codes.
: Return codes.  
This function returns the same codes as DosWrite:
 
* ERROR_ACCESS_DENIED
This function returns the same codes as DosWrite:  
* ERROR_BAD_UNIT
 
* ERROR_BROKEN_PIPE
* ERROR_ACCESS_DENIED  
* ERROR_INVALID_HANDLE
* ERROR_BAD_UNIT  
* ERROR_LOCK_VIOLATION
* ERROR_BROKEN_PIPE  
* ERROR_NOT_DOS_DISK
* ERROR_INVALID_HANDLE  
* ERROR_OUT_OF_PAPER
* ERROR_LOCK_VIOLATION  
* ERROR_WRITEFAULT
* ERROR_NOT_DOS_DISK  
* NO_ERROR
* ERROR_OUT_OF_PAPER  
* ERROR_WRITEFAULT  
* NO_ERROR  
 


==Remarks==
==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).  
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==
<PRE>
#include <os2.h>
 
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);
</PRE>


[[Category:Spl]]
[[Category:Prt]]

Latest revision as of 15:57, 30 May 2021

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).