Mail Archives: djgpp/1995/07/24/09:13:59
Errors-To: postmaster AT ns1
Date: Fri, 21 Jul 95 10:03:20 EST
From: dpsm AT lubrizol DOT com
Content-Type: text
Content-Length: 726
I'm just starting to play with djgpp v2, and I have a question. How do you
set binary or text mode of the standard input and output?
From emacs.c:
#ifdef MSDOS
/* We do all file input/output as binary files. When we need to translate
newlines, we do that manually. */
_fmode = O_BINARY;
(stdin)->_flag &= ~_IOTEXT;
(stdout)->_flag &= ~_IOTEXT;
(stderr)->_flag &= ~_IOTEXT;
#endif /* MSDOS */
The #define _IOTEXT is not in stdio.h (it was in previous versions). Is it
the same as pre v2? Is there a "portable" or "standard" way to do this in
ANS C?
I remember twiddling bits like this with Borland, but I also seem to
remember a setmode() call, but if you knew my memory....
Thanks,
Dale
Try closing stdin/stdout and reopening with mode set to binary:
fclose( stdin );
stdin = fopen( "STDIN", "rb" );
fclose( stdout );
stdout = fopen( "STDOUT", "wb" );
I believe that the DJGPP library supports these symbolic file names. If not
you could try opening both stdin and stdout on the CON: device.
--
Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com
Variety is the soul of pleasure. -- Aphra Behn
- Raw text -