delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/21/05:30:36

From: "Mike S." <spence AT OUTternauts DOT ca DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: skipws
Date: Sat, 21 Apr 2001 05:19:11 -0400
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
NNTP-Posting-Host: ppp-7.internauts.ca
X-Original-NNTP-Posting-Host: ppp-7.internauts.ca
Message-ID: <3ae15053@rsl2.rslnet.net>
X-Trace: 21 Apr 2001 02:18:11 -0800, ppp-7.internauts.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

  Is there still a problem with the skipws formatting flag in the latest
version of DJGPP?  I have searched high and low for an answer to this
problem with no luck.  I was convinced that I had finally found it here:
http://www.delorie.com/djgpp/mail-archives/thread.cgi?msg=djgpp/1999/01/24/2
1:16:09, but it was another dead end, as Horst Kraemer suggested the use of
a statement opposite to what I suspect Mr. Derbyshire was _really_ after
(whitespace skipping is ON by default - I want to turn it OFF).  For
example, the following snippet does not behave as it should under v2.95.2,
although it works fine with TurboC++ v3.0:

#include <iostream>
void main(void)
{
   int i;
   cin.unsetf(ios::skipws);  /*DO NOT ignore whitespace*/
   cin >> i;
   if (cin.good())
      cout << "OK\n";
   else
      cout << "ERROR\n";
}

  When the user enters leading whitespace or even just Enter without any
input, it should set "failbit" in the stream error-status flags, thus
causing cin.good() to fail and print "ERROR".  It doesn't.  The cursor just
drops down a line and waits for input -- as it normally does by default.
Has this bug been addressed?

Thanks in advance for any info. :-)

Mike S.

To fix e-mail: replace "OUT" with "in"


- Raw text -


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