Delphi Basics Home  |  Delphi Basics .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
System.IO.Path.GetTempPath
 
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.
   Temporary file path :
   C:\DOCUME~1\Thomas\LOCALS~1\Temp\
  
   Temporary file name :
   C:\DOCUME~1\Thomas\LOCALS~1\Temp\tmp1AE1.tmp
 
© CodeGear 2006 - 2007. All rights reserved.