Board index » kylix » Problem with CR LF and FileWrite

Problem with CR LF and FileWrite


2005-08-25 08:46:21 PM
kylix2
Hi,
I'm using kylix3 an Suse Linux 8.2.
I try to send some diggits with the function filewrite to a serial port. It's neccesary, that the diggit-sequence begins with <cr><lf>. So, I fill a string-variable with the diggits an then I concat the string with the command tmpstr := chr(13)+chr(10)+tmpstr. But when I analyzed the string at the comport, I'll see <13><13><10>. Why is there a duplicate <13>?
Kind regards, Alex
 
 

Re:Problem with CR LF and FileWrite

"Alexander Wendorff" < XXXX@XXXXX.COM >writes:
Quote
I try to send some diggits with the function filewrite to a serial
port. It's neccesary, that the diggit-sequence begins with
<cr><lf>. So, I fill a string-variable with the diggits an then I
concat the string with the command tmpstr :=
chr(13)+chr(10)+tmpstr. But when I analyzed the string at the
comport, I'll see <13><13><10>. Why is there a duplicate <13>?
I have to guess, because you don't post minimal code.
But it seems that you write the digits as text. And filewrite seems to
convert '\n' (ASCII 10) to '\r\n' (ASCII 13,10). \n is the typical end
of line mark in C programs and in files on Unices. \r\n is the typical
end of line mark on DOS related platforms and in many Internet
protocols etc.