Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FOPEN() returns 0
Message
From
27/09/2004 11:59:34
 
 
To
27/09/2004 11:52:25
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00946247
Message ID:
00946304
Views:
29
Hi, Alan
Yes, I am sure it is a problem, because if the file handle is 0, the end and top numbers are 0 also, and I can look at the file and see things in it. There should be a difference between these two numbers.

Beth

>Since all VFP says is that FOPEN() will return -1 if the file is not opened, and the examples show that the error check looks for a Handle of < 0, are you sure that your result of 0 is a problem?
>
>Are you actually getting a problem that leads you to believe the file is not open?
>
>Alan
>
>>ctmpfile returns the full path to the 'Service.cfg' file.
>>
>>>What does ctmpfile return?
>>>
>>>This works for me:
>>>
>>>clear
>>>cConPath = sys(2003)+'\'
>>>ctmpfile = ALLTRIM(cConPath + "Service.cfg")
>>>?ctmpfile
>>>lnfileHandle=FOPEN(ctmpfile)
>>>?lnfilehandle
>>>lnEnd=FSEEK(lnFileHandle,0,2)
>>>? lnend
>>>IF lnfileHandle > 0
>>>	=FCLOSE(lnfileHandle)
>>>ENDIF
>>>
>>>
>>>>Hi, all
>>>> I am working in VFP8.
>>>> I have some code that is suppose to open a plain ascii file in read-only buffered mode (default mode) and find out if the file has something in it.
>>>>
>>>>ctmpfile = ALLTRIM(cConPath + "Service.cfg")
>>>>STORE FOPEN(ALLTRIM(ctmpfile)) TO lnFileHandle
>>>>STORE FSEEK(lnFileHandle,0,2) TO lnEnd
>>>>STORE FSEEK(lnFileHandle,0) TO lnTop
>>>>STORE FSEEK(lnFileHandle,0,1) TO lnCurrent
>>>>
>>>>
>>>>lnFileHandle comes back as 0 (zero) not -1 or 1. If I set code before this to be sure that the file is there, it comes back true. But the lnFileHandle still is set to 0.
>>>>Can anyone help me fix this problem??
>>>>
>>>>Thanks,
>>>>Beth
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform