So I'm new to C++, and I'm trying to read from an input file that has 2 columns, with, in this case, one column being a check number and the other being a check amount. What would the code for reading in the two columns separately, and how would i output the same data in columns in an output file?
Asked
Active
Viewed 42 times
-2
-
1Sorry, SO is not a tutoring service, get a good [C++ textbook](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) or read a tutorial site. – Barmar Mar 01 '18 at 01:39
-
See this link this could help. https://stackoverflow.com/questions/2706076/new-how-would-i-read-a-file-that-has-3-columns-and-each-column-contains-100-n – ccc Mar 01 '18 at 02:22
1 Answers
0
IMHO, your best effort is to read in both columns of data. This is usually more efficient than only reading one column (especially only the second column).
You can always not access the first column of data. But, you may find out later that you actually need the first column.
Search the internet for "C++ read file columns example".

Thomas Matthews
- 56,849
- 17
- 98
- 154