filutilh.inc 3.8 KB

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