filutilh.inc 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. THandle = Longint;
  14. Type
  15. TSearchRec = Record
  16. Time,Size, Attr : Longint;
  17. Name : TFileName;
  18. ExcludeAttr : Longint;
  19. FindHandle : THandle;
  20. {$ifdef Win32}
  21. FindData : TWin32FindData;
  22. {$endif}
  23. end;
  24. Const
  25. { File attributes }
  26. faReadOnly = $00000001;
  27. faHidden = $00000002;
  28. faSysFile = $00000004;
  29. faVolumeId = $00000008;
  30. faDirectory = $00000010;
  31. faArchive = $00000020;
  32. faAnyFile = $0000003f;
  33. { File open modes }
  34. fmOpenRead = $0000;
  35. fmOpenWrite = $0001;
  36. fmOpenReadWrite = $0002;
  37. { File seek origins }
  38. fsFromBeginning = 0;
  39. fsFromCurrent = 1;
  40. fsFromEnd = 2;
  41. Function FileOpen (Const FileName : string; Mode : Integer) : Longint;
  42. Function FileCreate (Const FileName : String) : Longint;
  43. Function FileRead (Handle : Longint; Var Buffer; Count : longint) : Longint;
  44. Function FileWrite (Handle : Longint; Var Buffer; Count : Longint) : Longint;
  45. Function FileSeek (Handle,Offset,Origin : Longint) : Longint;
  46. Procedure FileClose (Handle : Longint);
  47. Function FileTruncate (Handle,Size: Longint) : boolean;
  48. Function FileAge (Const FileName : String): Longint;
  49. Function FileExists (Const FileName : String) : Boolean;
  50. Function FindFirst (Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
  51. Function FindNext (Var Rslt : TSearchRec) : Longint;
  52. Procedure FindClose (Var F : TSearchrec);
  53. Function FileGetDate (Handle : Longint) : Longint;
  54. Function FileSetDate (Handle,Age : Longint) : Longint;
  55. Function FileGetAttr (Const FileName : String) : Longint;
  56. Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
  57. Function DeleteFile (Const FileName : String) : Boolean;
  58. Function RenameFile (Const OldName, NewName : String) : Boolean;
  59. Function FileSearch (Const Name, DirList : String) : String;
  60. {
  61. $Log$
  62. Revision 1.6 2000-01-07 16:41:43 daniel
  63. * copyright 2000
  64. Revision 1.5 1999/05/15 07:25:22 michael
  65. + Defined seek constants
  66. Revision 1.4 1999/02/09 12:38:43 michael
  67. * Fixed INt() proble. Defined THandle, included Filemode constants
  68. Revision 1.3 1999/02/02 21:21:37 michael
  69. + Added filetruncate
  70. Revision 1.2 1998/10/11 13:47:45 michael
  71. + Added disk functions
  72. Revision 1.1 1998/10/11 12:21:01 michael
  73. Added file calls. Implemented for linux only
  74. }