Page 1 of 1

Much faster cTempFile() function

PostPosted: 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  Expand view
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