Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Append records to a text file.
Message
De
09/09/2003 03:38:10
 
 
À
08/09/2003 10:10:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00827077
Message ID:
00827393
Vues:
11
Hi,
>Emailfile = "C:\EMAIL.TXT"
>SELE currfile
>SCAN
>   IF FILE(Emailfile)  && Does file exist?
>      gnErrFile = FOPEN(Emailfile,12)  && If so, open read-write
>      = FSEEK(gnErrFile, 0, 2)
>   ELSE
>      gnErrFile = FCREATE(Emailfile)  && If not, create it
>   ENDIF							
>   =FPUTS(gnErrFile,currfile.number)
>ENDSCAN
>=FCLOSE(gnErrFile)
>I am using the code above to write info from a table to a text file. The problem is that it only seems to write the first record to the file and doesn't append the rest. Also I cannot open the file until I close foxpro completely. Anyone know what I'm doing wrong here?

In addition to Sergey & Caroline's advice it's obviously good practice to check on the handle value returned from FCREATE() and FOPEN() - in this instance it would have pointed you to the cause of the problem...

Regards,
Viv
--------------------------------------------------------------------------------
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform