Much faster cTempFile() function

Post Reply
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Much faster cTempFile() function

Post by Antonio Linares »

FWH April users may change this function to get much faster printing previews:

Code: Select all

function cTempFile( cPath, cExtension )        // returns a temporary filename

   local cFileName

   static cOldName

   DEFAULT cPath := "", cExtension := ""
   
   if ! "." $ cExtension
      cExtension = "." + cExtension
   endif   

   while File( cFileName := ( cPath + LTrim( Str( GetTickCount() ) ) + cExtension ) ) .or. ;
         cFileName == cOldName
   end

   cOldName = cFileName

return cFileName
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply