Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)

edfseek(3) Guardian Native C Library Calls Reference Manual
NAME
edfseek - Sets the le-position indicator of an Edit le opened for ANSI I/O
LIBRARY
For G-series Guardian native processes: $SYSTEM.SYSnn.ZCRTLSRL
For G-series OSS native processes: /G/system/sysnn/zcrtlsrl
For H-series Guardian native processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
For H-series OSS processes: /G/system/zdllnnn/zcrtldll
SYNOPSIS
#include <stdio.h>
int edfseek(
FILE *stream,
long pos,
int pos_base);
PARAMETERS
stream Denotes an Edit le opened for ANSI I/O.
pos Species the desired le position. Depending on pos_base, the le position is
either a line number or a line offset.
pos_base Species whether the positioning is absolute or relative. pos is one of the fol-
lowing:
SEEK_SET Indicates that pos is a line number. The le is positioned at the
rst line whose line number is greater than or equal to the line
number requested.
SEEK_CUR Indicates that pos is the number of lines from the le-position
indicator; pos can be positive or negative.
SEEK_END Indicates that pos is the number of lines from the end of the le;
pos can be either zero or negative. If zero, the le is positioned
at the next line to be written (the end of the le). If negative, pos
species how many lines to skip backwards.
DESCRIPTION
The edfseek() function sets the le-position indicator of an Edit le opened for ANSI I/O. If the
specied line exists, the le position is set to the beginning of that line. If the line does not exist,
the le position is set to the beginning of a line chosen by edfseek().
If you specify a line beyond the last line in the le, the le is positioned at the beginning of the
next line to be written to the le. If you specify a line before the rst line in the le, the le is
positioned at the beginning of the rst line.
The edfseek() function can be called from Guardian modules (modules compiled for the Guar-
dian environment) within Guardian and OSS processes. It cannot be called from OSS modules.
The Edit le must be opened with the fopen( ) or freopen( ) Guardian functions variants. Refer
to the fopen(3) or freopen(3) reference pages for details.
The edfseek() function resets the end-of-le (EOF) and errno.
Line numbers are numeric labels that are sorted in numeric order. Because line numbers are not
sequence numbers, a requested line number might not be in the le. This is not an error, and the
line number (the next higher line number in the le), rather than -1, is returned.
Relative positioning (using pos_base values SEEK_CUR or SEEK_END) is slower than abso-
lute positioning (using pos_base value SEEK_SET) because it requires sequential scanning of
170 Hewlett-Packard Company 527192-007