Article View: comp.std.c++
Article #2465Re: a gotcha in getline(istream,string) -- why...?
From: Dr. Richard Botting
Date: Wed, 08 Nov 1995 02:52
Date: Wed, 08 Nov 1995 02:52
24 lines
1969 bytes
1969 bytes
Alex Martelli (martelli@cadlab.it) wrote: : Trying to explain to a newbie how to do input by whole lines in C++, : the way they easily used to do it with fgets in bad ol' C, I got bit : (besides a bug in the libg++ implementation of getline(), which just : points to some obscurity between the standard libraries' usages of : length/size/capacity for strings -- obscurity enough to confuse the : implementor) by a gotcha in the standard itself: [snip] : Why the gratuitous spec to setstate(failbit), even possibly to throw!, : for something as innocuous as an empty line (i.e., just the terminating While brousing the draft standard/working papers I found a footnote (This is in the WWW/HTML version, lib-iostreams....) 29) This implies an empty input line will not cause failbit to be set. -- dick@csci.csusb.edu=rbotting@wiley.csusb.edu. Find out what's new at http://www.csci.csusb.edu/doc/www.sites.html Disclaimer:`CSUSB may or may not agree with this message`. Copyright(1995):Copy this freely but include the following link to the <a href="http://www.csci.csusb.edu/dick/signature.html">author's signature</a> --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<47oqkv$kct@news.csus.edu>Path:
arc1-ca.pugleaf.net!in1.uu.net!bounce-backReferences:
<martelli.815502013@cadlab>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back Date: 08 Nov 95 02:52:38 GMT Approved: fjh@cs.mu.oz.au From: dick@silicon.csci.csusb.edu (Dr. Richard Botting) Newsgroups: comp.std.c++ Subject: Re: a gotcha in getline(istream,string) -- why...? X-Original-Date: 7 Nov 1995 23:38:07 GMT Organization: CS Dept., Calif. State Univ., San Bernardino Message-ID: <47oqkv$kct@news.csus.edu> References: <martelli.815502013@cadlab> X-Newsreader: TIN [version 1.2 PL2] X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMKAbjuEDnX0m9pzZAQHPTwF+PQzLhzIJciJgZ4mjf64BZS2eT6ifniAj HAlRwuUMSIMq10Gpku5Aqepe/yT3qg5R =HU0z