Open file and return file descriptor
Source position: bunxh.inc line 75
function FpOpen(
path: pChar ;
flags: cint ;
Mode: TMode
):cint ;
function FpOpen(
path: pChar ;
flags: cint
):cint ;
function FpOpen(
const path: RawByteString ;
flags: cint
):cint ;
function FpOpen(
const path: RawByteString ;
flags: cint ;
Mode: TMode
):cint ;
function FpOpen(
path: ShortString;
flags: cint
):cint ;
function FpOpen(
path: ShortString;
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 file descriptor, 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 fpOpen, fpwrite and fpCLose 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.