filutilh.inc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. File utility calls
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. Type
  13. TSearchRec = Record
  14. Time : Longint;
  15. Size : Int64;
  16. Attr : Longint;
  17. Name : TFileName;
  18. ExcludeAttr : Longint;
  19. {$ifdef unix}
  20. FindHandle : Pointer;
  21. Mode : TMode;
  22. {$else unix}
  23. FindHandle : THandle;
  24. {$endif unix}
  25. {$ifdef Win32}
  26. FindData : TWin32FindData;
  27. {$endif}
  28. {$ifdef netware_clib}
  29. FindData : TNetwareFindData;
  30. {$endif}
  31. {$ifdef netware_libc}
  32. FindData : TNetwareLibcFindData;
  33. {$endif}
  34. end;
  35. Const
  36. { File attributes }
  37. faReadOnly = $00000001;
  38. faHidden = $00000002;
  39. faSysFile = $00000004;
  40. faVolumeId = $00000008;
  41. faDirectory = $00000010;
  42. faArchive = $00000020;
  43. faAnyFile = $0000003f;
  44. { File open modes }
  45. fmOpenRead = $0000;
  46. fmOpenWrite = $0001;
  47. fmOpenReadWrite = $0002;
  48. { Share modes}
  49. fmShareCompat = $0000;
  50. fmShareExclusive = $0010;
  51. fmShareDenyWrite = $0020;
  52. fmShareDenyRead = $0030;
  53. fmShareDenyNone = $0040;
  54. { File seek origins }
  55. fsFromBeginning = 0;
  56. fsFromCurrent = 1;
  57. fsFromEnd = 2;
  58. Function FileOpen (Const FileName : string; Mode : Integer) : Longint;
  59. Function FileCreate (Const FileName : String) : Longint;
  60. Function FileCreate (Const FileName : String; Mode : Integer) : Longint;
  61. Function FileRead (Handle : Longint; Var Buffer; Count : longint) : Longint;
  62. Function FileWrite (Handle : Longint; const Buffer; Count : Longint) : Longint;
  63. Function FileSeek (Handle,FOffset,Origin : Longint) : Longint;
  64. Function FileSeek (Handle : Longint; FOffset,Origin : Int64) : Int64;
  65. Procedure FileClose (Handle : Longint);
  66. Function FileTruncate (Handle,Size: Longint) : boolean;
  67. Function FileAge (Const FileName : String): Longint;
  68. Function FileExists (Const FileName : String) : Boolean;
  69. Function DirectoryExists (Const Directory : String) : Boolean;
  70. Function FindFirst (Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
  71. Function FindNext (Var Rslt : TSearchRec) : Longint;
  72. Procedure FindClose (Var F : TSearchrec);
  73. Function FileGetDate (Handle : Longint) : Longint;
  74. Function FileSetDate (Handle,Age : Longint) : Longint;
  75. Function FileGetAttr (Const FileName : String) : Longint;
  76. Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
  77. Function DeleteFile (Const FileName : String) : Boolean;
  78. Function RenameFile (Const OldName, NewName : String) : Boolean;
  79. Function FileSearch (Const Name, DirList : String) : String;
  80. Function FileIsReadOnly(const FileName: String): Boolean;
  81. Function GetFileHandle(var f : File):Longint;
  82. Function GetFileHandle(var f : Text):Longint;
  83. {
  84. $Log$
  85. Revision 1.8 2004-12-19 18:03:29 michael
  86. + Added mode field to TSearchRec for Kylix compatibility
  87. Revision 1.7 2004/10/03 20:27:00 armin
  88. * changed defines for netware
  89. Revision 1.6 2004/09/05 00:02:40 armin
  90. * added target netwlibc
  91. Revision 1.5 2004/05/01 11:56:25 marco
  92. * fileno -> getfilehandle
  93. Revision 1.4 2004/05/01 11:04:34 marco
  94. * fileno
  95. Revision 1.3 2004/04/28 20:48:20 peter
  96. * ordinal-pointer conversions fixed
  97. Revision 1.2 2004/02/08 14:50:51 michael
  98. + Added fileIsReadOnly
  99. Revision 1.1 2003/10/06 21:01:06 peter
  100. * moved classes unit to rtl
  101. Revision 1.10 2003/04/01 15:57:41 peter
  102. * made THandle platform dependent and unique type
  103. Revision 1.9 2003/03/29 18:21:41 hajny
  104. * DirectoryExists declaration changed to that one from fixes branch
  105. Revision 1.8 2003/03/28 19:06:59 peter
  106. * directoryexists added
  107. Revision 1.7 2003/01/03 20:41:04 peter
  108. * FileCreate(string,mode) overload added
  109. Revision 1.6 2002/09/07 16:01:22 peter
  110. * old logs removed and tabs fixed
  111. }