Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking ignore() for values

Tags:

c++

stream

When you use ignore() in C++, is there a way to check those values that were ignored? I basically am reading some # of chars and want to know if I ignored normal characters in the text, or if I got the newline character first. Thanks.

like image 469
Crystal Avatar asked Nov 18 '25 00:11

Crystal


1 Answers

I don't believe so - you'd have to "roll your own".

In other words, I think you'd have to write some code that read from the stream using get(), and then add some logic for keeping what you need and ignoring the rest (whilst checking to see what you're ignoring).

like image 111
razlebe Avatar answered Nov 20 '25 12:11

razlebe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!