filutilh.inc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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.10 2005-02-14 17:13:31 peter
  89. * truncate log
  90. Revision 1.9 2005/01/24 18:25:46 olle
  91. + a tiny bit of support for macos
  92. }