FSeek


Function FSeek( file index, offset )


Returns the new file position.


Syntax FSeek( 1, -1 ) ' Seeks to the end of a file.


Remarks

file index is the index to a file previously opened by a successful call to FOpen .

There are some constants with special meaning to FSeek.

if Offset is -1, FSeek will seek to the end of a file. This is important because any file opened with FOpen will automatically be positioned at the beginning of the file.

This is appropriate for reading, but to append lines to the end of the file, a call to FSeek with offset==-1 is required.

If offset is zero or less than -1, FSeek will position the file pointer to the beginning of a file.


See Also:

FTell FOpen File and Directory functions


Example Script


' Getting length of a file the hard way.

'(SHOULD USE FILELEN)


STRING a


a = FINDFIRST("*.*")

WHILE LEN(a)

PRINT a

IF FOPEN(1,a) THEN

PRINT FSEEK(1,-1)

FCLOSE(1)

ENDIF

a = FINDNEXT()

WEND


Script Output

(your result may be different)


CHDIR.txt

84

CHR.txt

149

COS.txt

202

CWD.txt

85