Home About us Development Training Support |
Reading a low level fileThe FREAD(<filehandle>,<numbytes>) function reads numbytes characters from the file. It starts reading from the current position in the file and moves its pointer numbytes characters along the file time each time that you call this function. If you ask it to read more bytes than there are in the file then it will return all the bytes available and move the pointer beyond the end of the file. No error will be raised when this happens but you can call the FEOF() function to test whether you have passed the end of the file. This example reads groups of 10 bytes from a text file and prints them out.
lnFileHandle=
FOPEN("file.txt")
DO WHILE NOT FEOF(lnFileHandle) ?FREAD(lnFileHandle, 10) ENDDO FCLOSE(lnFileHandle) The FREAD() function treats all characters in the same way. It ignores the special meaning of ASCII characters 10 and 13 (LineFeed and CarriageReturn) and counts them as individual characters. Another low level function, FGETS() will read complete lines of characters and is much more suitable for processing text files. Other low level topicsLow level overview | FCREATE() | FOPEN() | FCLOSE() | FWRITE() |
Hints & tips
The textbox class in Visual FoxPro 9 has a new Autocomplete
property which shows the user the previous values that have
been entered in that textbox.
More...
|