Retrieves a file from disk into a string, and stores a string to a file. Dual function method handles both reading and writing of strings to and from files.

Unlike STRTOFILE and FILETOSTR in the VFP language, File2Var is multi-user safe and provides for retries if a file is locked.

o.File2Var(tcFileName, tcString, tlSharedWriteMode)

Return Value

String when reading from file or "" if an error occurs. .T. or .F. when writing a string to file.


File name to retrieve when reading to string. File name to save to when saving to file.

String to write to file when writing to file.

Only applies to writing - when .T. the file is written in shared write mode which means if the file is open in another application in shared mode the file will get written anyway. Be careful with this mode flag as it can easily cause confusion between two applications.

Encodes the file written to UTF8. No BOM written.

See also:

Library wwUtils

© West Wind Technologies, 1996-2019 • Updated: 01/14/16
Comment or report problem with topic