Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Low Level File Command Error
Message
De
11/09/2003 04:26:48
 
 
À
10/09/2003 10:29:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Documentation de produit
Divers
Thread ID:
00827799
Message ID:
00828076
Vues:
11
>>>>>I am experiencing an intermittant problem creating or opening text files. FOPEN and FCREATE both will occationally return an empty string rather than a numeric file handle. If I exit VFP and restart it works fine. I am running VFP7 SP1 on Win2k Pro Build 5 SP4. Any thoughts on this would be appreciated.
>>>>
>>>>
>>>>Jeff,
>>>>
>>>>Just finished reading your answer to Cetin.
>>>>
>>>>It is most likely imo that you have a currently selected table/cursor with a field name that is the same as your variable
>>>>
>>>>this is consistent with the behaviour of gets() && fputs() you described
>>>>
>>>>
>>>>&& 6sp5
>>>>?fgets('  ', 20) && returns empty string, no error
>>>>?fgets('  ', 20) && no error
>>>>
>>>
>>>That's a good thought but what i'm doing is calling a method that builds a string using date and file type for next available file name and assigning the return value a variable which is only used here lsEdiOutFile. Then using that variable to create a file.
>>>
>>>
>>>lsEdiOutFile = this.Get837name(lcFormType)
>>>lnEdiOutFile = FCREATE(lsEdiOutFile)
>>>IF ! lnEdiOutFile > 0
>>>	WAIT WINDOW 'Cannot Create OutPut File ' + lsEdiOutFile
>>>	RETURN
>>>ENDIF
>>>
>>>* Code to build output strings
>>>
>>>=FPUTS(lnEdiOutFile, lsHLSegment)
>>>
>>>
>>>
>>>lsEdiOutFile is a string containing the name of the file built. lnEdiOutFile usually is a numeric containing the file handle. But about once a week lnEdiOutFile contains a blank string. lsEdiOutFile is built but cannot be accessed by the file handle and is not returning any errors. The file can only be closed by exiting VFP. I did not think that it was possible for FOPEN or FCREATE to return anything other than a numeric.
>>>
>>>thanks jeff
>>
>>Jeff,
>>
>>If fcreate() were to return anything other than numeric and null, then you would get an error on the line where you test it to be greater than zero.
>>
>>Do you get an error there ?? If not, would anything in the program be resetting it ?
>
>No on both counts which is strange. Although I have a blank string assigned to lnEdiOutFile it is not giving a data mismatch error. I have caught the problem and suspended the program to look in the debugger but didn't think to look at vartype. it shows as a blank string (not null) but i didn't test for null. Also, why is Fputs not complaining about a non-numeric file handle. (To compound the strangeness, I have the same thing happening with other code on an FOPEN where FGETS returns empty strings from a file with the same non-numeric file handle.)

Fputs() and fgets() not complaining about a non numeric fd is a bug imo.
Test the return type of fcreate(). If this one passes and you still find lnEdiOutFile to be blank it is one of the following possibilities

(1) vfp's memory has gone bezerk ( not very likely)
(2) you have an alias with field name lnEdiOutFile
(3) you re-assign lnEdiOutFile somewhere by one means or another (if it is a private var, make it local, just in case)
(4) You wouldn't be confusing lnEdiOutFile and lsEdiOutFile, would you ?
(5) ... (out of ideas)

Success,
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform