I know how to read in files and how to avoid spaces. But how do you only get the program to read in values that appear only AFTER a 'return' in a normal .txt file, i.e if the first value isn't right then ignore the rest of the line.
james
This is a discussion on reading in files within the C++ Programming forums, part of the General Programming Boards category; I know how to read in files and how to avoid spaces. But how do you only get the program ...
I know how to read in files and how to avoid spaces. But how do you only get the program to read in values that appear only AFTER a 'return' in a normal .txt file, i.e if the first value isn't right then ignore the rest of the line.
james
My site to register for all my other websites!
'Clifton Bazaar'
Use some form of check to validate the data read in. Use "getline" to read in the entire line. Then check the first portion with strcmp to see if it matches your pre-defined value to ignore, if so, go on to the next line, if not, process the data in.Originally posted by phantom
I know how to read in files and how to avoid spaces. But how do you only get the program to read in values that appear only AFTER a 'return' in a normal .txt file, i.e if the first value isn't right then ignore the rest of the line.
james
You could also try something like this:
#include <ctype.h>
ifstream file;
while (isalnum(file.peek()) {
// Read in data ...
// blah blah blah
it uses the "is alapha numeric"
good luck
Skeptic
Thanks for the responses, I'll get right onto it today![]()
My site to register for all my other websites!
'Clifton Bazaar'