www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/05/29/23:24:18

Subject: Re: stdin, stdout and friends, was: fstat() yet again
To: eliz AT is DOT elta DOT co DOT il
Date: Sun, 29 May 1994 21:24:23 -0600 (CDT)
Cc: ericb AT lsid DOT hp DOT com, djgpp AT sun DOT soe DOT clarkson DOT edu
From: mcastle AT umr DOT edu (Mike Castle)

Amazingly enough eliz AT is DOT elta DOT co DOT il said:
> My question is: is there ANY way to change open mode (TEXT vs BINARY) of the
> stdin stream WITHOUT reopening it (which we obviously cannot do, as indicated
> by Eric Backus)?  I think there is no PORTABLE (i.e. ANSI) way, but maybe
> something DOS-specific or DJGPP-specific?

setmode(fileno(FILE*),O_BINARY);

ie:

setmode(fileno(stdin),O_BINARY);

This appears to work with any DOS compiler, and many OS/2
compilers (only one I know it doesn't work on is IBM's C/SET
compiler).  

mrc
-- 
Mike Castle .-=NEXUS=-.  Life is like a clock:  You can work constantly
  mcastle AT cs DOT umr DOT edu     and be right all the time, or not work at all
   mcastle AT umr DOT edu       and be right at least twice a day.  -- mrc
    We are all of us living in the shadow of Manhattan.  -- Watchmen

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019