|
From: <dan...@ya...> - 2002-03-20 09:01:55
|
--- Soren Andersen <sor...@sp...> wrote: > Hello, > > Is it a known issue that using the gcc-win32 ports (MinGW for sure, > Cygwin maybe), the ANSI C library call fdopen() is buggy or weird? > Believe it or not, fdopen is not in ANSI standard. So, you really can't call any implementation-specific behaviour a bug or a feature or a wierd. > Testcase: try the arguments to fdopen thusly: > fdopen ( fileno(stdin), "rb" ); > as would happen if one was trying to handle redirection (anon pipe or > <). This stdin redirected from another program's stdout will NOT be in > binary mode, it will be in text mode, and the calling program will > likely error if it is requiring a binary read. > > I've seen programmers do some of this: > #ifdef WIN32 > # define USE_SETMODE 1 > #endif > . > . > . > #ifdef USE_SETMODE > setmode( fileno(stdin), O_BINARY ); > #endif > Yup thats what I do too. > In order to compensate for this. Is this special case really a bug, or > is it a technicality, something like "because the stdout is already > open, we aren't technically opening a new file descriptor, but rather > just referring to an existing one, so we don't call this a bug [maybe > we call it 'one of the many extraordinary pleasures of working on > windoze']"? You may also want to look at freopen, which is part of the pleasures of working with ANSI. Danny > > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users http://movies.yahoo.com.au - Yahoo! Movies - Vote for your nominees in our online Oscars pool. |