Mail Archives: djgpp/1996/07/03/17:54:05
Reply to message 7890269 from NORBERTJ AT PANI on 07/03/96 10:49AM
>In a test program using getche(), the echo to the screen could not
>redirect to a file as in test >test.txt. printf() works fine.
Not to sound like I'm berating you for complete stupidity or anything,
but have you bothered to read the documentation for getche()? It
works by reading directly from the BIOS keyboard, and writing
directly to the text screen via the BIOS. It never sends anything to
DOS, so DOS can't redirect it. That applies to the entire family
of conio functions (getch, getche, putch, cprintf, cputs, cscanf, etc.).
OTOH, the standard i/o functions (printf, scanf, getchar, putchar, etc.)
write to stdout, which is a DOS file descriptor, and thus subject to DOS
redirection. The same goes for stdin and stderr (and stdprn and stdaux,
technically, but it's very difficult to redirect those from DOS. ;)
John
- Raw text -