Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clarification of Previous Thread : COPY TO command 1

Status
Not open for further replies.

kraus

MIS
Oct 16, 2000
23
US
this is matthew again,

thank you for your quick responses (especially you-Walid). you have all given me educated opinions on my dilema. thank you. i wish to give further detail.

i am trying to import a deliminated-text file into foxpro 6.0. the file is deliminated w/carriage return line feeds, designating end of each field, and carriage return form feed to designate the end of each record. VFP would then makes changes to to the file.

i then need to export the file to a commercial injetting system (must be in text format). i do this by the 'COPY TO' command i mentioned before. the problem is: at the end of each record (in the exported file) where there is supposed to be only a carriage return form feed (0D 0C), foxpro inserts a line feed (0D 0A 0C) between the carriage return and form feed.

how do i stop this?

thank you, matt kraus
 
there is supposed to be only a carriage return form feed

"Form feed"? Wow, that's a new one. I explored using the DELIMITED WITH options of COPY TO, but I don't think they'll let you change the row delimiters to that degree.

You could write a low-level export easy enough, something similar to this untested code:

[tt]use MyTable
hOutFile = fcreate("MyExportFile.TXT")
scan
fwrite(hOutFile, MyColumn1 + MyColumn2 + MyColumn3)
fwrite(hOutFile, chr(13) + chr(9)) && not sure of FF char
endscan
fclose(hOutFile) [/tt] Robert Bradley
Coming Soon:
 
Matt,
A "simple" fix, would be to do a FILETOSTR(), STRTRAN(), STRTOFILE() after your COPY TO statement. i.e.

COPY TO output.txt ....
lcTempstr = FILETOSTR("output.txt")
lcTempstr = STRTRAN(lcTempstr, chr(13)+chr(10)+chr(12),;
chr(13)+chr(12))
=STRTOFILE(lcTempstr, "output.txt")


Rick


 
Hi my friend,
You very wellcome. It is my pleasure to help
Did you try to use the import wizard from VFP, it is a little bit slow but it works just fine.
Go to tools,Wizards,Importing and play with it. Also don't forget to read its help.
Good luck Walid Magd
Engwam@Hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top