{
This sample code is presented as is.
Although every reasonable effort has been
made to insure the soundness of the example
below, Idioma Software inc. makes no warranty
of any kind with regard to this program sample
either implicitly or explicitly.
This program example may be freely distributed for the
use of writing computer programs only. Any other use of
this material requires written permission from Idioma Software inc.
(c) 1997 Idioma Software inc. All rights reserved.
}
{
This example shows how to get a temporary file name
}
function TempFileName : String;
{Author Jon Vote 10/97}
const Unique : word = 0;
var DriveLetter : char;
pTempFileName : pchar;
dummy : word;
Prefix : pChar;
begin
Prefix := 'TMP';
pTempFileName := StrAlloc(256);
DriveLetter := GetTempDrive(' ');
{convert 'A' to '1', ... 'C' to '3' - etc}
DriveLetter := chr(ord(DriveLetter) - 18);
dummy := GetTempFileName(DriveLetter, PreFix, Unique, pTempFileName);
ShowMessage('Temp filename is: ' + strpas(pTempFileName));
TempFileName := strpas(pTempFileName);
end;