#include <lcio.h> int kseek(FILE *f, int pos);
kseek
function repositions the stream associated with the FILE
object addressed by f
, as specified by the value of pos
, and
releases control of any current record. The pos
value must be either
SEEK_SET
, SEEK_CUR
, or SEEK_END
. (These constants are
defined in <stdio.h>
.) Each of these values refers to a specific location
in the file, as follows:
SEEK_SET
SEEK_CUR
SEEK_END
If the current record is read for update, the record is released and is read
for update by another FILE
object. Even though kseek
with
pos
value SEEK_CUR
causes no change in the file's positioning, it
is still useful to release control of the current record.
kseek
function returns 0 if successful, or a negative value if an
error occurred.
#include <lcio.h> int getlast(FILE *f, void *buf) { int length; rc = kseek(f, SEEK_END); if (rc < 0) return rc; /* in case it fails */ /* Retrieve backwards from EOF. */ length = kretrv(buf, NULL, K_BACKWARDS, f); return length; }
ksearch
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.