FGetc


Function FGETC ( file index )


Returns a 1 byte string consisting of the next character in the file represented by file index.


Syntax A = FGETC (1)


Remarks

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

FGETC returns a one character string which represents the next byte from the file opened on file index.

If there are no characters to retrieve in the file, or the next byte is an ASCII value of 0, FGETC will return an empty string.

FGETC ( ) does not necessarily contain a printable value.


See Also:

FGets FPutc File and Directory functions


Example Script


NUMBER x = 1

STRING a = "*.txt",b


a = FINDFIRST(a)

WHILE LEN(a)

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

PRINT "File is "; a

a = FINDNEXT()

b = b + FGETC(x) + " " ' Accumulating the first byte out of each file opened.

FCLOSE(x)

WEND

PRINT "First byte out of all these files is: "

PRINT b

END


Script Output

(your results may be different)


File is CHDIR.txt

File is CHR.txt

File is COS.txt

File is CWD.txt

File is EXP.txt

File is EXP10.txt

File is EXP2.txt

File is ABS.txt

File is ACOS.txt

File is ASC.txt

File is ASIN.txt

File is ATN.txt

File is FCLOSE.txt

File is FCLOSEALL.txt

File is FEOF.txt

File is FGETC.txt

First byte out of all these files is:

73 78 78 83 78 39 39 78 78 83 78 78 78 78 78 78