file() -returns .f. when file is present?

file() -returns .f. when file is present?

Postby reinaldocrespo » Thu Jan 05, 2012 1: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: Select all  Expand view

   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.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: file() -returns .f. when file is present?

Postby reinaldocrespo » Thu Jan 05, 2012 1:23 am

Never mind. I found the problem.

Thank you,


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: file() -returns .f. when file is present?

Postby Otto » Thu Jan 05, 2012 1:28 pm

Hello Reinaldo,
what was the problem?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6331
Joined: Fri Oct 07, 2005 7:07 pm

Re: file() -returns .f. when file is present?

Postby reinaldocrespo » Thu Jan 05, 2012 2: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.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: file() -returns .f. when file is present?

Postby Otto » Thu Jan 05, 2012 4: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=3&t=21740&p=115743&hilit=smb#p115743
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6331
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 78 guests