help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'sysutils' (#rtl)

FileOpen

Open an existing file and return a filehandle

Declaration

Source position: filutilh.inc line 74

function FileOpen(

  const FileName: String;

  Mode: Integer

):THandle;

Description

FileOpen opens a file with name FileName with mode Mode. Mode can be one of the following constants:

fmOpenRead
The file is opened for reading.
fmOpenWrite
The file is opened for writing.
fmOpenReadWrite
The file is opened for reading and writing.

If the file has been successfully opened, it can be read from or written to (depending on the Mode parameter) with the FileRead and FileWrite functions.

Remark: Remark that you cannot open a file if it doesn't exist yet, i.e. it will not be created for you. If you want tp create a new file, or overwrite an old one, use the FileCreate function.

For an example, see FileOpen

Errors

On Error, -1 is returned.

See also

FileClose

  

Close a file handle.

FileWrite

  

Write data from a buffer to a given filehandle.

FileCreate

  

Create a new file and return a handle to it.

FileRead

  

Read data from a filehandle in a buffer.

FileTruncate

  

Truncate an open file to a given size.

FileSeek

  

Set the current file position on a file handle.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505