Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Append records to a text file.
Message
 
À
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:
00827085
Vues:
15
Try opening/creating the file outside of the scan loop.
Emailfile = "C:\EMAIL.TXT"
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							

SELE currfile
SCAN
   =FPUTS(gnErrFile,currfile.number)
ENDSCAN
=FCLOSE(gnErrFile)
HTH
cj

>Hi,
>
>[code]
>
>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)
>[/code]
>
>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?
Caroline
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform