cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
getline out of stringstream should not c
getline out of stringstream should not cut leading whitespace
Jul 1, 2013 at 1:24pm UTC
m3t4lukas
(2)
Hi all,
I have a std::stringstream sstr I read data from with getline(sstr, s, ',').
Now I don't want it to cut off the leading blanks. How can I do that?
Thanks in advance
Lukas
Last edited on
Jul 1, 2013 at 1:37pm UTC
Jul 1, 2013 at 2:07pm UTC
JLBorges
(13770)
std::getline()
does not discard leading white space.
http://ideone.com/51ZG7d
Jul 1, 2013 at 2:10pm UTC
m3t4lukas
(2)
Hi again,
I found it out, so in case anybody else is looking for it, here it is:
The stream needs to be fed with std::noskipws like this:
1
2
std::stringstream sstr; sstr << std::noskipws;
HTH
Lukas
Topic archived. No new replies allowed.