This tips comes from our partner SwissDelphiCenter.ch
mailto:info@delphitips.com.
Author:
Gustav Evertsson
function GetTempFile(const Extension: string): string;
var
Buffer: array[0..MAX_PATH] OF Char;
begin
GetTempPath(Sizeof(Buffer)-1,Buffer);
GetTempFileName(Buffer,'~',0,Buffer);
result := StrPas(Buffer);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(GetTempFile('.tmp'));
// The temp. file looks like C:\WINDOWS\TEMP\~61D5.TMP
end;
{Note:
The GetTempFile function just returns a unique filename but
doesn't create the file. }
1 comment:
Where is the "extension" used in that function?
Post a Comment