FILETOSTR( ) Function
Returns the contents of a file as a character string.
FILETOSTR(cFileName)
Return Values
Character
Parameters
- cFileName
Specifies the name of the file whose contents are returned as a character string. If the file is in a directory other than the current default directory, include a path with the file name.
Remarks
Note that the size of the character string FILETOSTR( ) returns can be very large. The amount of available memory or disk space determines if you can store the character string to a memory variable, array element, or memo field. Also, character fields in Visual FoxPro are limited to 254 characters. See Visual FoxPro System Capacities for more information about limitations on character type data.
Example
The following code loads REDIST.TXT into a character string, then counts the number of merge modules mentioned in the text. REDIST.TXT ships with Microsoft Visual FoxPro and lists, which Visual FoxPro files, may be redistributed with your applications.
CD HOME()
cRedist=FILETOSTR("REDIST.TXT")
?OCCURS(".MSM",cRedist)
See Also
FGETS( ) | FREAD( ) | STRTOFILE( ) | Visual FoxPro System Capacities