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 - get current value of file position indicator (BS2000)

&pagelevel(4)&pagelevel

Syntax

#include <stdio.h>

long tell(int fildes);

Description

tell() returns the current value of the file position indicator for the file associated with file descriptor fildes. tell() 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.

fildes is the file descriptor of the file for which the current value of the file-position indicator is to be determined.

Return val.

current value of the file position indicator



i.e. the number of bytes that offsets the file position indicator from the beginning of the file, for binary files, if successful.


absolute position of the file position indicator



for text files, if successful.


-1

if an error occurs; errno is set to indicate the error (e.g. tell() not permitted; number of blocks or records too large).

Notes

The calls tell( fildes ) and lseek( fildes, 0L, SEEK_CUR) are equivalent.
tell() cannot be applied on 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

See also

lseek(), fseek(), ftell(), stdio.h.