How is textmode/binmode determined in Cygwin 1.1.0 net releas e for pipes?
Chris Faylor
cgf@cygnus.com
Thu Apr 27 21:16:00 GMT 2000
On Thu, Apr 27, 2000 at 11:51:50PM -0400, David Bolen wrote:
>I suppose my question can be rephrased as whether or not 1.1.0 changed
>the default behavior for pipes from b20.1 (without any CYGWIN
>environment setting)? It was my understanding that the default should
>be binary, and that's how my previous b20.1 seemed to be working. But
>1.1.0 seems to instead be defaulting to text. This would be for pipes
>opened via the pipe() call, thus without any particular O_* flags.
The test below indicates that pipes are being opened in binmode by
default.
And, here's another observation. The best way to answer a question like
"How does xxx work" is to write a test case which exercises 'xxx'. This
is even better than reading the source for 'xxx'.
cgf
#include <time.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <sys/times.h>
main(int argc, char **argv)
{
int pipes[2];
char buf[80];
pipe(pipes);
setmode(pipes[1], O_BINARY);
write(pipes[1], "hello\r\n", 7);
printf ("%d = read(%d...)\n", read(pipes[0], buf, 80), pipes[0]);
}
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
More information about the Cygwin
mailing list