Page 1 of 1

Much faster cTempFile() function

Posted: Sat Apr 08, 2006 8:38 pm
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