Mail Archives: djgpp/1995/11/02/15:13:14
In article <47946c$9al AT woodstock DOT socs DOT uts DOT EDU DOT AU> jkmarsha AT socs DOT uts DOT edu DOT au (Justen Keven Marshall) writes:
>
>Hi
> I am at my wits end trying to print a line-feed
> without a carriage return. (Or the other way around.)
> What happens is that when I try to print char(10) in
> a file, with printf redirected, fprintf, cout, putchar,
> fputchar, or whatever, it puts BOTH not just one.
> I need only one, since I want to put the ascii char 10
> in the file. I'm using MS-Dos 7.0 (Win95) but it does
> it with 6.22 as well. Is it the fault of DJGPP, GO32,
> or something I'm doing? I tried the same thing in Turbo
> Pascal (the only other language I have) and it didn't
> do it, so I suspect it is something about C or DJ itself.
> Thanks for your help...
Open your output file for *binary* output:
FILE *fp = fopen("myfile.out", "wb");
^^^
This 'b' (binary) will do the trick.
Pieter.
- Raw text -