cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
reading in from datafile, how to skip re
reading in from datafile, how to skip rest of line?
Sep 24, 2012 at 1:31pm UTC
enosmac
(17)
I'm new so bear with me. I have a datafile that contains a function I need to perform, then an integer or two I need to perform them one For example:
ADD 10101010 00010000
NOT 00010100 01110101
CONVERT 10110110
LSHIFT 00100100 3
JUNK 01001001
ADD 11111100 00000001
So, I'll read in ADD, read in the next 2 integers and perform my add function.
The problem I have is the datafile will contain invalid commands like JUNK. How would I read in JUNK, then skip to the next line ignoring the rest of the line?
Sep 24, 2012 at 1:41pm UTC
Peter87
(11234)
datafile.ignore(std::numeric_limits<std::streamsize>::max(),
'\n'
);
Topic archived. No new replies allowed.