[Overview][Constants][Types][Procedures and functions] | Reference for unit 'BaseUnix' (#rtl) |
Open file and return file descriptor
Source position: line 0
function FpOpen( |
path: pChar; |
flags: cint; |
Mode: TMode |
):cint; |
path: pChar; |
flags: cint |
):cint; |
path: AnsiString; |
flags: cint |
):cint; |
path: AnsiString; |
flags: cint; |
Mode: TMode |
):cint; |
path: String; |
flags: cint |
):cint; |
path: String; |
flags: cint; |
Mode: TMode |
):cint; |
FpOpen opens a file in Path with flags flags and mode Mode One of the following:
The flags may beOR-ed with one of the following constants:
Path can be of type PChar or String. The optional mode argument specifies the permissions to set when opening the file. This is modified by the umask setting. The real permissions are Mode and not umask. The return value of the function is the filedescriptor, or a negative value if there was an error.
Extended error information can be retrieved using fpGetErrno.
|
Close file descriptor |
|
|
Read data from file descriptor |
|
|
Write data to file descriptor |
|
|
Truncate file on certain size. |
|
|
Set file pointer position. |
Program Example19; { Program to demonstrate the fdOpen, fdwrite and fdCLose functions. } Uses BaseUnix; Const Line : String[80] = 'This is easy writing !'; Var FD : Cint; begin FD:=fpOpen ('Test.dat',O_WrOnly or O_Creat); if FD>0 then begin if length(Line)<>fpwrite (FD,Line[1],Length(Line)) then Writeln ('Error when writing to file !'); fpClose(FD); end; end.
No notes exist for this page yet.