Delphi creates a temporary file

From , 2 Years ago, written in Delphi (Object Pascal), viewed 90 times.
URL https://pastebin.vip/view/2f73168b
  1. function TempFileName(const Stub: string; const Create: Boolean): string;
  2. begin
  3.   // Get temporary folder
  4.   SetLength(Result, Windows.MAX_PATH);
  5.   Windows.GetTempPath(Windows.MAX_PATH, PChar(Result));
  6.   // Get unique temporary file name (it is created as side effect of this call)
  7.   if Windows.GetTempFileName(
  8.     PChar(Result), PChar(Stub), 0, PChar(Result)
  9.   ) <> 0 then
  10.   begin
  11.     // Succeeded
  12.     Result := PChar(Result);
  13.     if not Create then
  14.       // user doesn't want file creating: so we delete the file
  15.       SysUtils.DeleteFile(Result);
  16.   end
  17.   else
  18.     // Failed
  19.     Result := '';
  20. end;
  21. //delphi/2228

Reply to "Delphi creates a temporary file"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website