From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2001-04-04T03:40:04+09:00 Subject: [ruby-talk:13464] redirecting $stdin I'm trying to be able to write to STDIN - yeah, its a strange thing to do, I know, but I've got to send a control-C to a child process created with Win32 CreateProcess calls and it seems like a good way to do it. I can do this on Solaris and it seems to work: ################################### stdin_num = $stdin.fileno puts "stdin fileno is: #{stdin_num}" save_stdin = $stdin.clone begin stin = IO.new(stdin_num,"w") stin.putc "^C" rescue puts "got #{$!}" end $stdin.reopen(save_stdin) #################################### but on WinNT I get: "stdin fileno is: 0" "got Bad file number" This is coming from the IO.new(0,"w") 0 seems to be illegal here for Windows (I can put a 1 or 2 there corresponding to stdout and stderr, but not a 0 corresponding to stdin). Any ideas? Is this just one of those things you can't do on Windows? Phil