Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)
Guardian Native C Library Calls (a - e) edfseek(3)
the file.
For absolute positioning (using pos_base value SEEK_SET), pos is the Edit line number multi-
plied by 1000. For example, 23000L corresponds to line 23, and 44120L corresponds to line
44.12.
Using absolute positioning, edfseek() sets the file position to the specified line if and only if the
specified line exists in the file. If the specified line does not exist in the file, edfseek() sets the file
position to the lowest-numbered line whose number exceeds the speci
fied line number. If no
such line exists, edfseek() sets the file position past the end-of-file by selecting the line number
that a subsequent write operation would generate.
For example, assume that a file contains lines 1000, 1500, 2000, 2100. Specifying edfseek(...,
SEEK_SET):
• for lines 0..999 sets the position to line 1000.
• for lines 1001..1499 sets the position to line 1500.
• for line 1500 sets the position to line 1500.
• for line 2100 sets the position to line 2100.
• for lines 2101 and beyond sets the position to line 3000.
If an Edit file is empty, edfseek(... , SEEK_SET) for any specified line sets the file position to
line 1000.
The purpose of edfseek() with the SEEK_SET option is to set the file’s current position to a line
that is known to exist: for example, at a line with a location captured by a prior call to edftell().
edfseek(... , SEEK_SET) will not adjust the file position to an arbitrary nonexistent line that the
program intends to generate with a subsequent write. So, if a file contains lines 1000 and 2000,
you cannot use edfseek(fp, 1500, SEEK_SET) to cause fprintf(fp, ... ) to generate a new line
numbered 1500.
RETURN VALUES
Upon successful completion, the value 0 (zero) is returned. Otherwise, edfseek() returns EOF
and sets errno.
ERRORS
If the following condition occurs, the edfseek() function sets errno to the corresponding value:
[EINVAL] The stream is an invalid stream.
For all other error conditions, errno is set to the Guardian file-system error number. Refer to the
Guardian Procedure Errors and Messages Manual for more information about a specific Guar-
dian file-system error.
RELATED INFORMATION
Functions: edftell(3).
STANDARDS CONFORMANCE
The edfseek() function is an HP extension to the XPG4 Version 2 specification.
527192-005 Hewlett-Packard Company 1−67