Mail Archives: djgpp/1999/10/03/11:51:45
Horst Kraemer wrote:
> On Sat, 02 Oct 1999 23:18:58 +0800, dsk <dseeker AT pd DOT jaring DOT my> wrote:
>
> > I HADDD been trying all the stuff and I still can't print control key
> > (eg ascii 10,11) to
> > a file. I got odd results in the output file.
>
> Open the file in binary mode:
>
> fp = fopen("stuff","wb");
> fp = fopen("stuff","rb");
>
> By default "r" and "w" open in text mode. In text mode (char)10=='\n'
> is translated by DOS compilers to the sequence 13 10 and 13 10 are
> read back as a single (char)10=='\n'.
>
> You may read back a "text" file written "wb" even with "r". DOS
> compilers like DJGPP will treat a single 10 without preceding 13 as
> valid \n.
>
> Regards
> Horst
Yeap I tried that one but it just blow me up. I run DJGPP on WinDOSBox.
I don't know what happened but fprintf, putc etc.. just won't work.
Is there a problem with this simple (overdefining) lines?
FILE *_outfile = fopen("test.zzz", "wb");
fprintf( _outfile, "%1c", (char)10&0xFF);
Do you have hardcoding technique to stripe the 13 in front of control key
[dsk]
- Raw text -