1 | Open file handle | Input | Char(16) |
2 | Data buffer | Input | Char(*) |
3 | Bytes to write | Input | Binary(4) |
4 | Bytes actually written | Output | Binary(4) |
5 | Error code | I/O | Char(*) |
The Write to Stream File (QHFWRTSF) API writes bytes to a stream file. The file must have been opened with an access mode of write only or read/write. If there is a deny write or deny read/write lock on a byte range being written to, the function fails.
The write operation starts at the current position of the file pointer, the location in the file where the next read or write operation occurs. When a file is opened with the Open Stream File (QHFOPNSF) API the file pointer is set to the first byte of the file. You can move the pointer explicitly with the QHFCHGFP API; see Change File Pointer (QHFCHGFP) API for details. After the write operation, the file pointer value is increased by the number of bytes written.
None.
The file handle returned when the file is opened with the QHFOPNSF API.
The buffer containing the data being written.
The number of bytes being written to the file, starting at the current file pointer position. The number must be less than or equal to the length of the data buffer.
The application can write beyond the end of the file. This increases the file's size.
The number of bytes actually written to the file. If an error occurs during the write operation, the value of this parameter can be less than the value of the bytes-to-write input parameter.
The structure in which to return error information. For the format of the structure, see Error Code Parameter.
Message ID | Error Message Text |
---|---|
CPF1F2B E | Write operation not allowed to file opened for read only. |
CPF1F2E E | Range of bytes in file in use. |
CPF1F25 E | File handle not valid. |
CPF1F28 E | Damaged file. |
CPF1F34 E | Attempted write operation beyond file size limit. |
CPF1F36 E | Write file operation failed. |
CPF1F4B E | Value for number of bytes not valid. |
CPF1F41 E | Severe error occurred while addressing parameter list. |
CPF1F52 E | Error code not valid. |
CPF1F61 E | No free space available on media. |
CPF1F62 E | Requested function failed. |
CPF1F63 E | Media is write protected. |
CPF1F66 E | Storage needed exceeds maximum limit for user profile &1. |
CPF1F71 E | Exception specific to file system occurred. |
CPF1F72 E | Internal file system error occurred. |
CPF1F73 E | Not authorized to use command. |
CPF1F74 E | Not authorized to object. |
CPF1F82 E | Function not supported. |
CPF1F87 E | Missing or damaged exit program &2. |
CPF3C90 E | Literal value cannot be changed. |
CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
Top | Hierarchical File System APIs | APIs by category |