www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/04/19/13:01:20

Message-Id: <199904191800.SAA66460@out4.ibm.net>
From: "Mark E." <snowball3 AT usa DOT net>
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, djgpp-workers AT delorie DOT com
Date: Mon, 19 Apr 1999 14:01:15 -0400
MIME-Version: 1.0
Subject: Re: Bug no. 277
In-reply-to: <Pine.SUN.3.91.990419180307.14514G-100000@is>
X-mailer: Pegasus Mail for Win32 (v3.01d)
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019