Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird-Record Pointer
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01507019
Message ID:
01507022
Views:
55
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform