Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:docs:fapi:doswrite [2020/12/04 13:02] – prokushev | en:docs:fapi:doswrite [2021/09/17 09:16] (current) – prokushev | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{logos:os2.gif? | + | {{page>en:templates:fapiint}} | 
| ====== DosWrite ====== | ====== DosWrite ====== | ||
| Line 5: | Line 5: | ||
| This call transfers the specified number of bytes from a buffer to the specified file, synchronously with respect to the requesting process' | This call transfers the specified number of bytes from a buffer to the specified file, synchronously with respect to the requesting process' | ||
| - | ==Syntax== | + | ===== Syntax | 
| - |  | + | <code c> | 
| + | DosWrite (FileHandle, | ||
| + | </ | ||
| - | ==Parameters== | + | ===== Parameters ===== | 
| - | ;FileHandle (HFILE) - input : File handle from DosOpen. | + | |
| - | ;BufferArea (PVOID) - input : Address of the output buffer. | + |  | 
| - | ;BufferLength (USHORT) - input : Number of bytes to write. | + |  | 
| - | ;BytesWritten (PUSHORT) - output : Address of the number of bytes written. | + |  | 
| + |  | ||
| + | |||
| + | ===== Return Code ===== | ||
| + | |||
| + | rc [[(USHORT]]) - return | ||
| - | ==Return Code== | ||
| - | rc (USHORT) - return | ||
| Return code descriptions are: | Return code descriptions are: | ||
| - | * 0 NO_ERROR | ||
| - | * 5 ERROR_ACCESS_DENIED | ||
| - | * 6 ERROR_INVALID_HANDLE | ||
| - | * 26 | ||
| - | * 33 | ||
| - | * 109 ERROR_BROKEN_PIPE | ||
| - | ==Remarks== | + | * 0 NO_ERROR | 
| + | * 5 ERROR_ACCESS_DENIED | ||
| + | * 6 ERROR_INVALID_HANDLE | ||
| + | * 26 | ||
| + | * 33 | ||
| + | * 109 ERROR_BROKEN_PIPE | ||
| + | |||
| + | ===== Remarks ===== | ||
| On output, BytesWritten is the number of bytes actually written. If BytesWritten is different from BufferLength, | On output, BytesWritten is the number of bytes actually written. If BytesWritten is different from BufferLength, | ||
| Line 31: | Line 38: | ||
| Buffers that are multiples of the hardware' | Buffers that are multiples of the hardware' | ||
| - | The file pointer is moved by read and write operations. It can be moved to a desired position by calling DosChgFilePtr. | + | The file pointer is moved by read and write operations. It can be moved to a desired position by calling | 
| If the file is read-only, the write to the file is not performed. | If the file is read-only, the write to the file is not performed. | ||
| - | ===Family API Considerations=== | + | ==== Family API Considerations ==== | 
| Some options operate differently in the DOS mode than in OS/2 mode. Therefore, the following restriction applies to DosWrite when coding for the DOS mode. | Some options operate differently in the DOS mode than in OS/2 mode. Therefore, the following restriction applies to DosWrite when coding for the DOS mode. | ||
| - | * Only single-byte DosWrite requests can be made to the COM device, because the COM device driver for the DOS environment does not support multiple-byte I/O. | + |  | 
| + | |||
| + | ==== Named Pipe Considerations ==== | ||
| - | ===Named Pipe Considerations=== | ||
| DosWrite is also used to write bytes or messages to a named pipe. | DosWrite is also used to write bytes or messages to a named pipe. | ||
| Line 51: | Line 60: | ||
| An attempt to write to a pipe whose other end has been closed returns ERROR_BROKEN_PIPE. | An attempt to write to a pipe whose other end has been closed returns ERROR_BROKEN_PIPE. | ||
| - | ==Example Code== | + | ===== Example Code ===== | 
| - | ===C Binding=== | + | |
| - | <PRE> | + | ==== C Binding ==== | 
| + | |||
| + | <code c> | ||
| #define INCL_DOSFILEMGR | #define INCL_DOSFILEMGR | ||
| Line 64: | Line 75: | ||
| USHORT | USHORT | ||
| - | </PRE> | + | </code> | 
| This example writes to a file. | This example writes to a file. | ||
| - | <PRE> | + | <code c> | 
| #define INCL_DOSFILEMGR | #define INCL_DOSFILEMGR | ||
| Line 108: | Line 119: | ||
|  |  | ||
| & | & | ||
| - | </PRE> | + | </code> | 
| - | ===MASM Binding=== | + | ==== MASM Binding ==== | 
| - | <PRE> | + | |
| + | <code asm> | ||
| EXTRN  DosWrite: | EXTRN  DosWrite: | ||
| INCL_DOSFILEMGR | INCL_DOSFILEMGR | ||
| Line 120: | Line 132: | ||
| PUSH@  WORD    BytesWritten | PUSH@  WORD    BytesWritten | ||
| CALL | CALL | ||
| + | </ | ||
| Returns WORD | Returns WORD | ||
| - | </ | ||
| - | |||
| - | ====== Note ====== | + | ===== Note ===== | 
| Text based on [[http:// | Text based on [[http:// | ||




