delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/22/18:39:34

From: Silverio <silverio AT cu DOT lu>
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp
Subject: EOF
Date: Wed, 22 Jan 1997 15:54:36 +0000
Organization: Centre Universitaire
Lines: 21
Message-ID: <32E6383C.750D@cu.lu>
NNTP-Posting-Host: rossini.infogest.cu.lu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I repost this message because I didn't receive any help  :-(

Can anybody explain why the following code works with BC5.0 and does not
work with DJGPP gcc version 2.7.2.1 ? The problem is that if the user
enters an EOF (CTRL Z in DOS) to stop the loop, the user is not prompted
to enter the double d !

#include <iostream.h>
int main() {
  int i;
  while(cin >> i) cout << i << endl;  // CTRL Z to stop the loop
  cin.clear();                        // reset the flags    
  double d;
  cin >> d;                           // with DJGPP gcc, the user cannot
enter a value 
  cout << d << endl;
}

Many thanks

Nino Silverio

- Raw text -


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