FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour file() -returns .f. when file is present?
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
file() -returns .f. when file is present?
Posted: Thu Jan 05, 2012 01:19 AM
Hi.

I'm checking for file existence using file( cfile ). It returns false. However when I check the directory, I see the file is present.

This is the file I'm checking for:

C:\Users\ADMINI~1\LOCALS~1\Temp\page001.png


Here is the actual code snippet:
Code (fw): Select all Collapse
   LOCAL cDir := GetTempDir()
...

   WinExec("gswin32c -dBATCH -dNOPAUSE -r150 -sDEVICE=png16m "+;
         "-dTextAlphaBits=4 -sOutputFile=" + cDir + "page%03d.png " +;
         cFile, 0 )

   //------------   just for debugging ---------------
   cPrnFile := cDir + "page"+StrZero( i, 3 )+".png"
   logfile( "trace.log", { cPrnFile, file( cPrnFile ) } )
   //---------------------------------------------------
   
   WHILE FILE( cPrnFile := cDir + "page"+StrZero( i, 3 )+".png" )

      ::oPrn:StartPage()
      ::oPrn:SayBitmap( 0, 0, cPrnFile )//, nWidth, nHeight, nRaster )
      ::oPrn:EndPage()
      logfile( "trace.log", { cPrnFile } )
      i++

   END


Here the function file() is always returning .f. even when the file does exists.

Any ideas what could be wrong?


Reinaldo.
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: file() -returns .f. when file is present?
Posted: Thu Jan 05, 2012 01:23 AM

Never mind. I found the problem.

Thank you,

Reinaldo.

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: file() -returns .f. when file is present?
Posted: Thu Jan 05, 2012 01:28 PM

Hello Reinaldo,
what was the problem?
Best regards,
Otto

Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: file() -returns .f. when file is present?
Posted: Thu Jan 05, 2012 02:54 PM

Hi Otto;

The problem was timing. WinExec() hadn't finished before the check for file() was being executed. I changed WinExec for Waitrun() and that fixed the timing problem.

Thank you,

Reinaldo.

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: file() -returns .f. when file is present?
Posted: Thu Jan 05, 2012 04:44 PM

Hello Reinaldo,
I only ask becouse I had similar problems when SMB 2 were on.
Search the forum for SMB.
Best regards,
Otto

viewtopic.php?f=3t=21740p=115743hilit=smb#p115743

&&&

Continue the discussion