Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Low-level file problems.
Message
De
19/03/2003 10:02:08
Leo Kool
Agis Automatisering BV
Harmelen, Pays-Bas
 
 
À
19/03/2003 09:48:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00767529
Message ID:
00767548
Vues:
11
Hi Steve,

You should check if lnFH > 0, otherwise the file isn't opened.
you can check for errors with executing "?FError()" just after fopen()
You can lookop the error code in VFP Help

HTH,
Leo
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform