Friday, July 31, 2009

How to input data from a txt file into a c++ vector?

I have a txt file that contains three lines as follows:





2302.9 4390.3 604.9j


393.9f 4059.3t 0509.c


395.d 39.7





I need to read this file line by line and input the values into a string vector. Any idea on how to do this ?

How to input data from a txt file into a c++ vector?
First, you need to know what a vector is and how to use it. Then you must use it to create a vector object that holds an array of string objects. Then you must load your data into it at an appropriate point in the procedure, there are a couple of options here. Starting with the information available from the URL below, I think you should find a way that will work well. Good luck.


No comments:

Post a Comment