blob: 157011f012ad2264d0025818096096b746a82cff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
{
This file is part of the Free Pascal run time library.
Copyright (c) 1999-2000 by the Free Pascal development team
File utility calls
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
Type
TSearchRec = Record
Time : Longint;
Size : Int64;
Attr : Longint;
Name : TFileName;
ExcludeAttr : Longint;
{$ifdef unix}
FindHandle : Pointer;
Mode : TMode;
PathOnly : AnsiString;
{$else unix}
FindHandle : THandle;
{$endif unix}
{$if defined(Win32) or defined(WinCE) or defined(Win64)}
FindData : TWin32FindData;
{$endif}
{$ifdef netware_clib}
FindData : TNetwareFindData;
{$endif}
{$ifdef netware_libc}
FindData : TNetwareLibcFindData;
{$endif}
{$ifdef MacOS}
FindData : TMacOSFindData;
{$endif}
end;
Const
{ File attributes }
faReadOnly = $00000001;
faHidden = $00000002;
faSysFile = $00000004;
faVolumeId = $00000008;
faDirectory = $00000010;
faArchive = $00000020;
faSymLink = $00000040;
faAnyFile = $0000003f;
{ File open modes }
fmOpenRead = $0000;
fmOpenWrite = $0001;
fmOpenReadWrite = $0002;
{ Share modes}
fmShareCompat = $0000;
fmShareExclusive = $0010;
fmShareDenyWrite = $0020;
fmShareDenyRead = $0030;
fmShareDenyNone = $0040;
{ File seek origins }
fsFromBeginning = 0;
fsFromCurrent = 1;
fsFromEnd = 2;
{ File errors }
feInvalidHandle : THandle = -1; //return value on FileOpen error
Function FileOpen (Const FileName : string; Mode : Integer) : THandle;
Function FileCreate (Const FileName : String) : THandle;
Function FileCreate (Const FileName : String; Mode : Integer) : THandle;
Function FileRead (Handle : THandle; Var Buffer; Count : longint) : Longint;
Function FileWrite (Handle : THandle; const Buffer; Count : Longint) : Longint;
Function FileSeek (Handle : THandle; FOffset, Origin: Longint) : Longint;
Function FileSeek (Handle : THandle; FOffset: Int64; Origin: Longint) : Int64;
Procedure FileClose (Handle : THandle);
Function FileTruncate (Handle : THandle;Size: Longint) : boolean;
Function FileAge (Const FileName : String): Longint;
Function FileExists (Const FileName : String) : Boolean;
Function DirectoryExists (Const Directory : String) : Boolean;
Function FindFirst (Const Path : String; Attr : Longint; out Rslt : TSearchRec) : Longint;
Function FindNext (Var Rslt : TSearchRec) : Longint;
Procedure FindClose (Var F : TSearchrec);
Function FileGetDate (Handle : THandle) : Longint;
Function FileSetDate (Handle : THandle;Age : Longint) : Longint;
Function FileSetDate (Const FileName : String;Age : Longint) : Longint;
Function FileGetAttr (Const FileName : String) : Longint;
Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
Function DeleteFile (Const FileName : String) : Boolean;
Function RenameFile (Const OldName, NewName : String) : Boolean;
Function FileSearch (Const Name, DirList : String) : String;
Function FileIsReadOnly(const FileName: String): Boolean;
Function GetFileHandle(var f : File):Longint;
Function GetFileHandle(var f : Text):Longint;
|