[Overview][Constants][Types][Procedures and functions][Variables][Index] |
Open file and return file descriptor
Source position: line 0
function fdOpen( |
pathname: String; |
flags: LongInt |
):LongInt; |
pathname: String; |
flags: LongInt; |
mode: LongInt |
):LongInt; |
pathname: pchar; |
flags: LongInt |
):LongInt; |
pathname: pchar; |
flags: LongInt; |
mode: LongInt |
):LongInt; |
fdOpen opens a file in PathName with flags flags One of the following:
The flags may beOR-ed with one of the following constants:
PathName 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.
Errors are returned in LinuxError.
|
Close file descriptor |
|
|
Read data from file descriptor |
|
|
Write data to file descriptor |
|
|
Truncate file on certain size. |
|
|
Flush kernel file buffer |
|
|
Set file pointer position. |
Program Example19; { Program to demonstrate the fdOpen, fdwrite and fdCLose functions. } Uses oldlinux; Const Line : String[80] = 'This is easy writing !'; Var FD : Longint; begin FD:=fdOpen ('Test.dat',Open_WrOnly or Open_Creat); if FD>0 then begin if length(Line)<>fdwrite (FD,Line[1],Length(Line)) then Writeln ('Error when writing to file !'); fdClose(FD); end; end.
lazarus-ccr.sourceforge.net |