file() function

Post Reply
andreaquaglia
Posts: 2
Joined: Fri Aug 08, 2008 3:32 pm
Location: italy
Contact:

file() function

Post by andreaquaglia »

I'm tryin to use the file() function to check if a file in the foldere "\My documents\immagini\" exists, but the function always returns .f. even if the file is there....
Any help ??
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Andrea,

In Windows Mobile there is no the concept of "drives", so we have to use the current directory. Please try this example:

test.prg

Code: Select all

#include "fwce.ch"

function Main()

   MsgInfo( File( CurDir() + "\test.exe" ) )

return nil 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Andrea,

You just have to remove the first slash bar:

test.prg

Code: Select all

#include "fwce.ch"

function Main()

   MsgInfo( File( "My Documents\myfile.txt" ) )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
andreaquaglia
Posts: 2
Joined: Fri Aug 08, 2008 3:32 pm
Location: italy
Contact:

Post by andreaquaglia »

thank you Antonio, everything works fine now.
There was a too little bug to be seen in my code!
Post Reply