Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
Low-level file problems.
Not being that familiar with low level file manipulation, i've encountered something that doesnt make good sense to me.
I have the following code:
lnFH = FOPEN('myfile.txt')
do while not feof(lnFH)
&& some other code here
enddo
fclose(lnFH)
The code above works fine on the first pass, but in order to get it to fire off again, I have to close vfp completely. On the second try, it is not going inside the DO/ENDDO. So logically I assume that the file pointer is moved to the end of the file from the first pass. I would have thought that it would have reset itself to the beginning by issuing the fclose?
Anyways, with this in mind, I tried moving the pointer to the beginning with:
lnFH = FOPEN('myfile.txt')
=FSEEK(lnFH,0,0) && GO TOP
do while not feof(lnFH)
&& some other code here
enddo
fclose(lnFH)
Well that still didnt work??
Furthermore I tried ? fseek(lnFH,0,1) and it returns 0. Isnt that the beginning of the file?
THis is probably one of those DUH moments, I must be overlooking the obvious.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement