Extract columns of data from input file into single variables

I read in an input file with 8 columns of data. I'd like to work with each column of data separately. Is there a way to work these columns directly or do I need to create different variables for each column and then work on these variables? If the latter, how do I create new variables? Thanks much!
You could get each line using http://www.cplusplus.com/reference/iostream/fstream/

Each time there is a line call a procedure that will process the line. That procedure will use http://www.cplusplus.com/reference/string/string/substr/ to split the line up in to columns.

You could use a string array. Global variables are declared outside of a procedure, such as the main.h file. I personally would use a nested linked list but this may be a little bit advanced for this forum.

Or if you are doing something simple to each column such as summing, you can just add each column up in the procedure as you are reading them.

Have a google search on the terms used and append the word C++ for more info.

Topic archived. No new replies allowed.