File.Open |
Top Previous Next |
Syntax function File.Open(Filename: string; FileMode: integer): pointer
Alternative Names
Description Opens or creates a file with the given Filename.
If there's a "encoding preamble" available in the file, the detected character encoding will be used for reading and writing text.
If you create a file with this function, there will be no encoding, you can use File.Create to create a file with a character encoding.
The FileMode parameter is one of the following:
The following additional options are available and can be combined with the previous options:
The Return value is a file-stream pointer that can be used for additional calls. If creating or opening of the file fails, NULL is returned.
See also
Example execute udsblock as begin /* open text file with UTF8 encoding preamble */ fs = File.Open('c:\data\utf8text.txt', __fmOpenReadWrite + __fmShareDenyWrite); try /* read a single line of text */ valueout = File.ReadLn(fs); finally File.Close(fs); end end |