filutil.inc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2012 by the Free Pascal development team
  4. File utility calls
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$ifndef SYSUTILS_HAS_UNICODESTR_FILEUTIL_IMPL}
  12. Function FileOpen (Const FileName : unicodestring; Mode : Integer) : THandle;
  13. begin
  14. Result:=FileOpen(ToSingleByteFileSystemEncodedFileName(FileName),Mode);
  15. end;
  16. Function FileCreate (Const FileName : UnicodeString) : THandle;
  17. begin
  18. Result:=FileCreate(ToSingleByteFileSystemEncodedFileName(FileName));
  19. end;
  20. Function FileCreate (Const FileName : UnicodeString; Rights : Integer) : THandle;
  21. begin
  22. Result:=FileCreate(ToSingleByteFileSystemEncodedFileName(FileName),Rights);
  23. end;
  24. Function FileCreate (Const FileName : UnicodeString; ShareMode : Integer; Rights : Integer) : THandle;
  25. begin
  26. Result:=FileCreate(ToSingleByteFileSystemEncodedFileName(FileName),ShareMode,Rights);
  27. end;
  28. {$endif}
  29. {$ifndef SYSUTILS_HAS_ANSISTR_FILEUTIL_IMPL}
  30. Function FileOpen (Const FileName : rawbytestring; Mode : Integer) : THandle;
  31. begin
  32. Result:=FileOpen(UnicodeString(FileName),Mode);
  33. end;
  34. Function FileCreate (Const FileName : RawByteString) : THandle;
  35. begin
  36. Result:=FileCreate(UnicodeString(FileName));
  37. end;
  38. Function FileCreate (Const FileName : RawByteString; Rights : Integer) : THandle;
  39. begin
  40. Result:=FileCreate(UnicodeString(FileName),Rights);
  41. end;
  42. Function FileCreate (Const FileName : RawByteString; ShareMode : Integer; Rights : Integer) : THandle;
  43. begin
  44. Result:=FileCreate(UnicodeString(FileName),ShareMode,Rights);
  45. end;
  46. {$endif}
  47. Function GetFileHandle(var f : File):THandle;
  48. begin
  49. Result:=filerec(f).handle;
  50. end;
  51. Function GetFileHandle(var f : Text):THandle;
  52. begin
  53. Result:=textrec(f).handle;
  54. end;