Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IF FILE() Not Firing...
Message
From
31/12/2001 13:20:19
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00599437
Message ID:
00599445
Views:
29
while
not empty(sys(2000,tcFile))
is reliable it has one unpleasant side effect I noticed recently

It uses the api
Handle = FindFirstFile(@FileSkeleton, @FindFileData)
The handle is not closed by vfp and hence you cannot remove the file. (unless another sys(2000) is done I suppose)

An alternative approach is this
*-----------------
Function	FileExists(FileName)
	declare Integer GetFileAttributes in win32api string @

	return (GetFileAttributes(@FileName) <> -1)
endfunc
*--------------------------------------------------------------------------
>FILE function is not exacly reliable, it was discussed here before. You better use adir and check for adir(laFiles,'c:\winnt\fonts\code39two.ttf')>0 There was another suggestion in this thread, but I have to find it first.
>
>Ok, here is one thread: Forum: Visual FoxPro Category: Coding, syntax & commands Title: Re: Verifying the existence of a file Thread #547744 Message #547827
>
>
>>I'm running the folloiwng:
>>
>>chkfile = 'c:\winnt\fonts\code39two.ttf'
>>
>>if file(chkfile)
>> **notify users with wait window
>> return
>>endif
>>
>>The problem is that the user is notified with the wait window like it's always finding the file. Even after I delete teh file. It still seems that it's finding it somehow...
>>
>>When I step through the code and enter file(chkfile) in the watch window, it shows a value of .f. but it's still falling thorugh like it's .t.
>>
>>Any ideas from anyone?
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform