Home  |  Delphi .net Home  |  System.IO.Path  |  GetTempPath Method
GetTempPath  
Method  
Gets the Directory (folder) for temporary files on the current machine
Path Class
System.IO NameSpace
CF1.  Function GetTempPath ( ) : String; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
The GetTempPath returns the path of the directory that can be used to hold a temporary file on the current platform/machine.
 
You can use GetTempFileName to let the Operating System generate an empty unique temporary file that you can use as temporary storage.
Microsoft MSDN Links
System.IO
System.IO.Path
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.IO;

begin
  Console.WriteLine('Temporary file path : ');
  Console.WriteLine(System.IO.Path.GetTempPath);
  Console.WriteLine;

  Console.WriteLine('Temporary file name : ');
  Console.WriteLine(System.IO.Path.GetTempFileName);

  Console.Readline;
end.
Show full unit code
  Temporary file path :
  C:\DOCUME~1\Neil\LOCALS~1\Temp\
  
  Temporary file name :
  C:\DOCUME~1\Neil\LOCALS~1\Temp\tmp1AE1.tmp
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author