Examples Delphi

1. Whats the API for generating a unique filename with a=20
specified extension ?
I use the following, hope it is of assistance.
Regards.
Peter.
//------------------------------------------------------------------------=
------
function tiGetTempFile( const pStrExt : string ) : string ;
const cMaxPathLen =3D 255 ;
var pcTemp : array[0..cMaxPathLen] of char ;
pcApp : array[0..cMaxPathLen] of char ;
pcPath : array[0..cMaxPathLen] of char ;
begin
strPCopy( pcApp, copy( extractFileName( application.exeName ), 1, 3 ) ) =
;
getTempPath( cMaxPathLen, pcPath ) ;
getTempFileName( pcPath, pcApp, 0, pcTemp ) ;
deleteFile( pcTemp ) ; // This is using the Window deleteFile, not Delph=
i's
result :=3D strPas( pcTemp ) ;
if pos( '.', result ) <> 0 then begin
if pStrExt =3D '' then begin
result :=3D tiRemoveExtension( result ) ;
end else begin
result :=3D copy( result, 1, pos( '.', result )) + pStrExt ;
end ;
end ;
end ;
//------------------------------------------------------------------------=
------
function tiRemoveExtension( pStrValue : string ) : string ;
var i : integer ;
begin
i :=3D tiPosR( '.', pStrValue ) ;
if i <> 0 then begin
result :=3D copy( pStrValue, 1, i - 1 ) ;
end else begin
result :=3D pStrValue ;
end ;
end ;