Syntax | #include <stdio.h> int fseek(FILE *stream, long int offset, int whence); | |||||||||||||||||||||||||||||||||||||||
Description | When POSIX files are executed, the function behaves in conformance with XPG as described below:
The new position, measured in bytes from the beginning of the file, is obtained by adding offset to the position specified by whence. The specified point is the beginning of the file for If the stream is to be used with wide character input/output functions, offset must either be 0 or a value returned by an earlier call to A successful call to If the most recent operation, other than
If the stream was opened for writing and buffered data has not yet been written to the underlying file, The There is no difference in functionality between BS2000
Text files (SAM in text mode, ISAM) can be positioned absolutely to the beginning or end of the file as well as to any position previously marked with Binary files (SAM in binary mode, PAM, INCORE) can be positioned absolutely (see above) or relatively, i.e. relative to beginning of file, end of file, or current position (by a desired number of bytes). The significance, combination options, and effects of the offset and whence parameters differ for text and binary files and are therefore discussed individually below: Text files (SAM in text mode, ISAM)Possible values:
Meaningful combinations and their effects:
Binary files (SAM in binary mode, PAM, INCORE)Possible values: Meaningful combinations and their effects:
Meaningful combinations and their effects:
| |||||||||||||||||||||||||||||||||||||||
Return val. | 0 -1 | if successful. if the specified file cannot be positioned. | ||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||
|
| The | ||||||||||||||||||||||||||||||||||||||
|
| The file descriptor underlying stream is not open for writing or the stream's buffer needed to be flushed and the file is not open. | ||||||||||||||||||||||||||||||||||||||
|
| An attempt was made to write a file that exceeds the maximum file size or the process file size limit (see also | ||||||||||||||||||||||||||||||||||||||
|
| The write operation was terminated due to the receipt of a signal, and no data was transferred. | ||||||||||||||||||||||||||||||||||||||
| The whence argument is invalid. The resulting file-position indicator would be set to a negative value. | |||||||||||||||||||||||||||||||||||||||
| An I/O error occurred. | |||||||||||||||||||||||||||||||||||||||
| There was no free space remaining on the device containing the file. | |||||||||||||||||||||||||||||||||||||||
| An attempt was made to write to a pipe or FIFO that is not open for reading by any process; a If threads are used, then the function affects the process or a thread in the following manner: If an EPIPE error occurs, the SIGPIPE signal is not sent to the process, but is sent to the calling thread instead. | |||||||||||||||||||||||||||||||||||||||
| The device does not exist or it cannot be accessed. | |||||||||||||||||||||||||||||||||||||||
| For fseek(): The resulting file offset value cannot be represented correctly in an object of type | |||||||||||||||||||||||||||||||||||||||
| For fseeko(): The resulting file offset value cannot be represented correctly in an object of type | |||||||||||||||||||||||||||||||||||||||
Notes | For POSIX files, the file offset returned by The program environment determines whether BS2000 If new records are written to a text file that was opened in the write or append mode and an Exception for ANSI functionality: It is not possible to position to system files (SYSDTA, SYSLST, SYSOUT). A successful In the case of record I/O,
If | |||||||||||||||||||||||||||||||||||||||
See also |
|