🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3735

Re: istrstreams and width

#3735
From: Bob Kline
Date: Tue, 19 Mar 1996 11:17
49 lines
2875 bytes
I have asked this question (with respect to the istream spec in general)
from time to time in this forum, and (until reading your article) have 
always attributed the lack of response to the theory that everyone else 
on the newsgroup was too young to understand what I was talking about.
:->}  Seriously, though, it would be nice if the newer I/O model provided
at least the level of support for formatted I/O as the model it purports
to replace, but there doesn't seem to be much interest.

Tim Ottinger (tottinge@csci.csc.com) wrote:
: We've already worked around this (identified two way to do so) but we 
: wonder why it doesn't work this way:

: Given:
:     istrstream source;
:     int i;
:     string s;
:     source >> setw(2) >> i >> s;

: With fixed length fields (yes, we have to read mainframe data from time to 
: time, and a few other odd sources), sometimes the fields are butted up
: against each other, and sometimes the strings have initial digit characters
: i them.

: When the stream contains "01115 N Neil", it would be nice if "01" and
: "115 N Neil" were broken out, but every compiler we try pulls "01115"
: as the number, and "N Neil" is the string.

: Of course, if we insert whitespace or use read, this works.  And we should
: use read() because we're doing fixed length, but I was wondering why setw()
: doesn't apply to integer extractors.

: Surely a lot of people have to read fixed-length records, and this is a
: common thing.

: Any thoughts?
: Tim

--
/*----------------------------------------------------------------------*/
/* Bob Kline                                       Stream International */
/* bob_kline@stream.com               formerly Corporate Software, Inc. */
/* voice: (703) 522-0820 x-311                      fax: (703) 522-5407 */
/*----------------------------------------------------------------------*/
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <4ikjlp$jbr@lhc.nlm.nih.gov>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
References: <4ibvn8$4gr@venus.roc.csci.csc.com>

Show Full Headers
Complete Article Headers
From: bkline@cortex.nlm.nih.gov (Bob Kline)
Message-ID: <4ikjlp$jbr@lhc.nlm.nih.gov>
X-Original-Date: 18 Mar 1996 21:13:29 GMT
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 19 Mar 96 11:17:49 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: Re: istrstreams and width
Organization: National Library of Medicine
References: <4ibvn8$4gr@venus.roc.csci.csc.com>
X-Newsreader: TIN [version 1.2 PL2]
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMU6YEeEDnX0m9pzZAQHn3AF+IlSfaS4kPd1hcPg+07uglxrUHHf5Okaj
 tZYAPr4BGrkksl5znqXkhp5mNbFOrZfZ
 =6nv2