[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
+---------------------------------+
| FSEEK |
+---------------------------------+
FSEEK(<expN1>, <expN2> [, <expN3>])
-----------------------------------
Moves file pointer in file opened with low-level file function.
Return value - Numeric
-----------------------------------
FSEEK() returns the current file pointer position relative to the
beginning of the file after it moves the file pointer.
The file pointer may also be moved with FREAD() and FWRITE().
<expN1>
File handle.
<expN2>
Number of bytes to move file pointer.
<expN3>
File pointer movement:
0 Relative to the beginning of the file (default)
1 Relative to the current file pointer position
2 Relative to the end of the file
+---------------------------------+
| Program Example |
+---------------------------------+
*** Move the file pointer to the top of the file:
STORE FSEEK(file_handle, 0) TO file1_bof
*** Move the file pointer to the 10th byte in the file:
STORE FSEEK(file_handle, 10) TO position10
*** Find the current file pointer position in the file:
STORE FSEEK(file_handle, 0, 1) TO position
*** Find out how big the file is:
STORE FSEEK(file_handle, 0, 2) TO file_size
*** Move the pointer backwards 5 bytes from the end of the file:
STORE FSEEK(file_handle, -5, 2) TO eof_minus5
The following user-defined function uses FSEEK() to return size of file.
If you do not include parameters in UDF, -2 is returned. If file cannot
be found, -1 is returned.
FUNCTION fsize2
PARAMETERS mfile && File to be checked
PRIVATE mhandle,fsize
IF PARAMETERS() = 0
RETURN -2 && Return -2 if no parameter passed
ELSE
IF !FILE(mfile)
RETURN -1 && Return -1 if file does not exist
ENDIF
ENDIF
mhandle = FOPEN(mfile) && Open file
fsize = FSEEK(mhandle,0,2) && Determine file size, assign to fsize
=FCLOSE(mhandle) && Close file
RETURN fsize && Return value
-----------------------------------
See Also: FCHSIZE(), FCLOSE(), FCOUNT(), FCREATE(), FEOF(), FERROR(),
FFLUSH(), FGETS(), FOPEN(), FPUTS(), FREAD(), FSIZE(), FWRITE()
-----------------------------------
See Also:
FCHSIZE()
FCLOSE()
FCOUNT()
FCREATE()
FEOF()
FERROR()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson