Home About us Development Training Support |
Open a low level fileThe FOPEN() function opens an existing file and returns a file handle. As before, it will return -1 if it cannot open the file so a real application must always check that the function has succeeded:
*-- Open the file ...
lnFileHandle = FOPEN ('fred.txt') *-- ... write some more text ... FWRITE (lnFileHandle, 'Hello world') *-- ... and close it again. FCLOSE (lnFileHandle) By default FOPEN() will create a file with Read-only access. You can still try to write data to the file with FWRITE() but no data will be written and no error will be raised. You can pass a second parameter to the function and force the file to be Read/Write or Write Only. Be careful. The numeric codes for this function are not the same as the codes for the FCREATE() function. WarningYou will be overwriting the contents of a file that you have opened with FOPEN(). If you want to append to the file then you have to read the original contents of the file into memory, add to that string and write the modified string back to the file. Other low level topicsLow level overview | FCREATE() | FCLOSE() | FREAD() | 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...
|