Mail Archives: djgpp-workers/1999/04/19/13:01:20
> Could people who know their way around C++ in general, and libstdc++ and
> iostreams in particular, please look at this bug and help me decide
> whether this has something to do with core DJGPP?
>
After some debugging, I've come up with a sample program that
illustrates what is going on:
#include <stdio.h>
int main()
{
int ch;
printf("Prompt 1: ");
ch = getc(stdin);
printf("\nPrompt 2: ");
ch = getc(stdin);
}
Compile and run the program. At the first prompt, press ctrl-z. The
second prompt is printed and the program immediately exits. This is
because the eof flag in stdin has been set from the first getc, thus an
EOF is returned without even checking the keyboard.
Is it intentional that pressing ctrl-z disables all further keyboard input
from functions like getc() that operate with a FILE pointer?
---
Mark Elbrecht, snowball3 AT usa DOT net
http://snowball.digitalspace.net/
- Raw text -