This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
question/problem using fcntl to change file mode from text to binary
- To: gnu-win32 at cygnus dot com
- Subject: question/problem using fcntl to change file mode from text to binary
- From: Peter Lu <swift at world dot std dot com>
- Date: Thu, 03 Jul 1997 17:06:43 -0400
Hi,
I am having problems using fcntl() to change a file which was
opened in text mode that I'd like to use in binary mode. In particular,
I'd like to change my standard input and output (fd=0 and fd=1) to
binary so that I can create a filter program. Right now, I do:
#include <fcntl.h>
....
flag = fcntl(0, F_GETFL);
flag |= _FBINARY;
fcntl(0, F_SETFL, flag);
....
but this doesn't seem to work. As a matter of fact, flag seems to
retrieve some nonsensible value (perhaps the fd itself).
If this doesn't work, how much work-around do I need to do? I read that
an open() with O_BINARY would do the trick for new files. Perhaps I'll
give fdopen a try. Does fcntl() work right now?
Thanks for any help. Please email swift@world.std.com.
Peter Lu
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".