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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do put CR/LF at the end of each line in an ASCII file

Status
Not open for further replies.

sampaloc

MIS
Jan 7, 2002
8
GU
objective:
source : foxpro table
destination: ascii file each line ended with CR/LF
 
Thanks for the initial solution but i tried that already.

I need to embed the codes "chr(13)+chr(10)" at the end of each line in that ascii file. Foxpro is interpreting the codes instead of appending it.

 
Are you saying you need a CRLF at the end of each field or just at the end of each record? What version and SP level of VFP are you using, and what OS (e.g. Win 98, XP Pro).

Rick
 
Nothing works better than ...

COPY TO myText.txt SDF

as suggested earlier.

It puts each record on a single line with a carriage return and line feed at the end of each line as a separator.

Now, if you are trying to put chr(13)+chr(10) as part of the data ... that is different and needs to be handled differently. Maybe you have not been clear about your needs.






Don


 
sampaloc,

Is this what you want to do?
Code:
alter table MyTable add column CRLF C(17)
replace all CRLF with '"chr(13)+chr(10)"'
COPY TO MyText.txt SDF

BTW, are you from Manila?

Medic
 
hello everybody,

I really appreciate your help on this.

What i intend to to create is an ascii file with detail lines terminated by CRLF.

e.g.

the quick brown fox jumps over the head of the lazy dogô◙
the quick brown fox jumps over the head of the lazy dogô◙
the quick brown fox jumps over the head of the lazy dogô◙

Did you see the codes at the end of each line? something like that. The required record layout must contain that character as the end of record marker for the upload program to recognize each line.

I already tried creating another field containing the
chr(13)+chr(10) codes

field1 CRLF
[the quick brown ...] [chr(13)+chr(10)]

select field1,CRLF from <file name> ;
into cursor <cursor name>

copy to <ascii file name> sdf


when i executed the script and checked the ascii file that was created it showed :

the quick brown fox jumps over the head of the lazy dog

the quick brown fox jumps over the head of the lazy dog

the quick brown fox jumps over the head of the lazy dog


The codes were interepreted instead of appending it at the end of each line.

It's getting complicated huh. Right now i am experimenting on the FILETOSTR and STRTOFILE functions of foxpro, and researching a lot.

Again I appreciate your help guys.

Thanks

sampaloc
 
medic,
yes i am from manila but not in the pi right now.
sampaloc
 
sampaloc,

You definitely won't see the CR/LF characters whenever you use a text file viewer/editor. It always interprets the CR/LF so you can see records as separate lines of info. Try using a binary file viewer and you should see the corresponding ASCII codes.

I'm not sure what type of uploader you have there. But basically, all upload programs that can read file records in text format requires only a single CR/LF pair to indicate end of record.

Medic
 
Hi all,

I downloaded the binary file viewer/editor and I was able to view the charcters i was looking for (2 happy faces). This TAR (Technical Assistance Request) is closed.


Thanks again guys for your help.

Salamat din medic sa tulong mo. Regards to all. :)
sampaloc
 
Salamat din medic sa tulong mo.

Walang anuman (You're welcome), sampaloc.

Incidentally, I'm also out of the country.


Medic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top