User`s guide

264
K
A
DAK
KwikNet Virtual File System
kvf_seek kvf_seek
Purpose Seek Within a Virtual File
Used by
n Task o ISP o Timer Procedure o Restart Procedure n Exit Procedure
Setup Prototype is in file KN_FILES.H.
#include "KN_LIB.H"
#include "KN_FILES.H"
int kvf_seek(KN_VFILE *vfd, long offset, int mode);
Description Vfd is a virtual file descriptor identifying a currently open virtual file.
Offset is the displacement from the origin specified by parameter mode to
which the virtual file's data pointer is to be set.
Mode defines the origin from which the seek is to be measured. Parameter
mode must be one of the following constants. These constants may be
defined in the standard C header file STDIO.H. If these constants are
not already defined, they are defined in header file KN_FILES.H.
SEEK_CUR Seek from the current file pointer position.
SEEK_END Seek from the end of the file.
SEEK_SET Seek from the beginning of the file.
Returns If successful, a value of 0 is returned and the virtual file pointer is
positioned at offset bytes from the origin specified by mode. If you try to
seek to a position prior to the beginning of the file, the file pointer is set to
the beginning of the file. If you try to seek beyond the end of the file, the
file pointer is set to the end of the file.
On failure, a value of -1 is returned. Possible reasons for the error are as
follows:
Parameter
vfd does not reference an open virtual file and there is no
underlying file system to handle the request.
Parameter mode does not specify one of the allowable constants.
You cannot seek at an
offset other than 0 in a compressed virtual file.
Note If the parameter vfd does not reference a currently open virtual file, the
request is passed on via the KwikNet Universal File System Interface to the
underlying real file system, if one exists. In such a case, the return value
will be dictated by the equivalent fseek() function.
See Also kvf_fsize(), kvf_tell()