filutilh.inc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. {$ifdef MacOS}
  35. FindData : TMacOSFindData;
  36. {$endif}
  37. end;
  38. Const
  39. { File attributes }
  40. faReadOnly = $00000001;
  41. faHidden = $00000002;
  42. faSysFile = $00000004;
  43. faVolumeId = $00000008;
  44. faDirectory = $00000010;
  45. faArchive = $00000020;
  46. faAnyFile = $0000003f;
  47. { File open modes }
  48. fmOpenRead = $0000;
  49. fmOpenWrite = $0001;
  50. fmOpenReadWrite = $0002;
  51. { Share modes}
  52. fmShareCompat = $0000;
  53. fmShareExclusive = $0010;
  54. fmShareDenyWrite = $0020;
  55. fmShareDenyRead = $0030;
  56. fmShareDenyNone = $0040;
  57. { File seek origins }
  58. fsFromBeginning = 0;
  59. fsFromCurrent = 1;
  60. fsFromEnd = 2;
  61. Function FileOpen (Const FileName : string; Mode : Integer) : Longint;
  62. Function FileCreate (Const FileName : String) : Longint;
  63. Function FileCreate (Const FileName : String; Mode : Integer) : Longint;
  64. Function FileRead (Handle : Longint; Var Buffer; Count : longint) : Longint;
  65. Function FileWrite (Handle : Longint; const Buffer; Count : Longint) : Longint;
  66. Function FileSeek (Handle,FOffset,Origin : Longint) : Longint;
  67. Function FileSeek (Handle : Longint; FOffset,Origin : Int64) : Int64;
  68. Procedure FileClose (Handle : Longint);
  69. Function FileTruncate (Handle,Size: Longint) : boolean;
  70. Function FileAge (Const FileName : String): Longint;
  71. Function FileExists (Const FileName : String) : Boolean;
  72. Function DirectoryExists (Const Directory : String) : Boolean;
  73. Function FindFirst (Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
  74. Function FindNext (Var Rslt : TSearchRec) : Longint;
  75. Procedure FindClose (Var F : TSearchrec);
  76. Function FileGetDate (Handle : Longint) : Longint;
  77. Function FileSetDate (Handle,Age : Longint) : Longint;
  78. Function FileGetAttr (Const FileName : String) : Longint;
  79. Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
  80. Function DeleteFile (Const FileName : String) : Boolean;
  81. Function RenameFile (Const OldName, NewName : String) : Boolean;
  82. Function FileSearch (Const Name, DirList : String) : String;
  83. Function FileIsReadOnly(const FileName: String): Boolean;
  84. Function GetFileHandle(var f : File):Longint;
  85. Function GetFileHandle(var f : Text):Longint;
  86. {
  87. $Log$
  88. Revision 1.9 2005-01-24 18:25:46 olle
  89. + a tiny bit of support for macos
  90. Revision 1.8 2004/12/19 18:03:29 michael
  91. + Added mode field to TSearchRec for Kylix compatibility
  92. Revision 1.7 2004/10/03 20:27:00 armin
  93. * changed defines for netware
  94. Revision 1.6 2004/09/05 00:02:40 armin
  95. * added target netwlibc
  96. Revision 1.5 2004/05/01 11:56:25 marco
  97. * fileno -> getfilehandle
  98. Revision 1.4 2004/05/01 11:04:34 marco
  99. * fileno
  100. Revision 1.3 2004/04/28 20:48:20 peter
  101. * ordinal-pointer conversions fixed
  102. Revision 1.2 2004/02/08 14:50:51 michael
  103. + Added fileIsReadOnly
  104. Revision 1.1 2003/10/06 21:01:06 peter
  105. * moved classes unit to rtl
  106. Revision 1.10 2003/04/01 15:57:41 peter
  107. * made THandle platform dependent and unique type
  108. Revision 1.9 2003/03/29 18:21:41 hajny
  109. * DirectoryExists declaration changed to that one from fixes branch
  110. Revision 1.8 2003/03/28 19:06:59 peter
  111. * directoryexists added
  112. Revision 1.7 2003/01/03 20:41:04 peter
  113. * FileCreate(string,mode) overload added
  114. Revision 1.6 2002/09/07 16:01:22 peter
  115. * old logs removed and tabs fixed
  116. }