tcgetattr(0, &T) fails on redirection

Keraba keraba@yahoo.com
Tue Nov 2 11:49:00 GMT 1999


The following code:

#include <sys/termios.h>

main()
{
  struct termios T;
  if (tcgetattr(0, &T) == 0)
    printf("Succeeded\n");
  else
    printf("Failed\n");
}

works when I simply execute

./program

but fails when I run

./program < file

Is the standard input file descriptor not 0 in this case ?
If so, how do I find out what it is ?
Or perhaps one can't run tcgetattr on this file descriptor ?
If its impossible, how does one put standard input into
raw mode in this case ?

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list