FTell


Function FTell( file index )


Returns the current read/write position in the file represented by file index.


Syntax x = FTELL( 1 )


Remarks

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

FTell returns the number of bytes from the beginning of a file, where the next read or write operation will take place. With each open file there is an associated file pointer maintained by the operating system, the pointer is a long integer representing the current position in the file.

FTell lets you know where that pointer is.


See Also:

FSeek FileLen File and Directory functions


Example Script


NUMBER x = 1

STRING a = "*.txt"


a = FINDFIRST(a)

WHILE LEN(a)

FOPEN(x,a) ' x contains 1 on the first pass

a = FINDNEXT()

WHILE NOT FEOF(x) AND FTELL(x) < 100 ' print at least 100 bytes from each file, unless the file is shorter than 100 bytes

PRINT FGETS(x)

WEND

FCLOSE(x)

WEND


Script Output

(your results may be different)


IF CHDIR("C:\Temp") THEN

PRINT CWD()

ELSE

PRINT "Directory not found."

ENDIF


NUMBER i,j

' let's print the ASCII chart (this might get messy).

FOR i = 0 TO 15

FOR j = 0 TO 15