Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Weird-Record Pointer
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01507019
Message ID:
01507022
Vues:
57
>I wrote a long program which is an automated process and which uses FPUTS() to write the data to a text file. Everything is looking good in the data before using FPUTS. The problem I now have is that the last record in the table ends up as the first record, the second record, and so on that appears in the text file. However, while I am in DEBUG mode stepping through the program, I see that the record pointer is actually sitting on the first record; this is totally odd, because the data which writes to the text file first is the 21st record, not the 1st. Why is this?
>
>I'l put in some of the code:
>
>
>SELECT tmpData
>SET ORDER TO ID
>
>outputFileName=outputPath + SUBSTR(DTOS(RunDate), 5) + "_" + "BOGUSTEST.TXT"
>ERASE (outputFileName)
>fh=FCREATE(outputFileName)	&& Default is Read/Write in FCREATE().
>IF fh > 0
>	* File creation succeeded! Now, write the header to the text file.
>	=FPUTS(fh, lcHeader)	&& The Header string, lcHeader, was created earlier.
>	GO TOP
>	SCAN
>		* Assemble the text data.
>		lc = m.GrpID
>		lc = lc + m.GrpNum
>		lc = lc + PADR(m.FirstName, 15)
>		lc = lc + IIF(EMPTY(m.Initial), " ", m.Initial)
>		lc = lc + PADR(m.LastName, 20)
>
Can you post more code from your SCAN loop? May be you're not writing every record?

BTW, you may try using TEXTMERGE instead of creating a string first and then using fputs.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform