Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
tell - Return current position of read/write pointer (elementary)
&pagelevel(4)&pagelevel
Definition | #include <stdio.h> long tell(int fd); tell returns the current position of the read/write pointer for the file with file descriptor fd.
The tell function may be used for binary files (PAM, INCORE) as well as text files (SAM, ISAM). SAM files are always processed as text files with elementary functions. |
Return val. | Position in the file if successful, i.e. |
| for binary files, the number of bytes that offsets the read/write pointer from the beginning of the file; for text files, the absolute position of the read/write pointer. |
-1 | if an error occurs. In addition, corresponding error information is stored in errno (e.g. tell not permitted, number of blocks or records too large). |
Notes | The calls tell(fd) and lseek(fd, 0L, SEEK_CUR) are equivalent. tell cannot be used for system files (SYSDTA, SYSLST, SYSOUT).
Since information on the file position is stored in a field that is 4 bytes long, the following restrictions apply to the size of SAM and ISAM files when processing them with tell/lseek : SAM file Record length | <= 2048 bytes | Number of records/block | <= 256 | Number of blocks | <= 2048 | ISAM file Record length | <= 32 Kbytes | Number of records | <= 32 K |
|
Example | See example under lseek . |
See also | lseek, lseek64, fseek, fseek64, ftell, ftell64 |