Not sure if you want to add the extra number in so you know how long the vector is. Otherwise you would have to read it in and check for the commas.
#include <iostream>
#include <vector>
#include <deque>
#include <fstream>
using namespace std;
struct Entry
{
int addr;
int dst;
int size;
vector<int> path;
};
/* "test.txt"
1 A0003 128 3 4 4 4
2 A0005 128 4 1 8 3 2
3 A0002 128 2 2 2
*/
int main()
{
deque<Entry> myFile;
ifstream in("test.txt");
Entry temp;
while( in >> temp.addr )
{
int counter;
in >> hex >> temp.dst >> dec >> temp.size >> counter;
temp.path = vector<int>(counter);
for( int i = 0; i < counter; i++ )
in >> temp.path[i];
myFile.push_back(temp);
}
in.close();
//not sure if you wanted this to print to a file or something but its exactly the same just make an ofstream and replace cout
for( unsigned int i = 0; i < myFile.size(); i++ )
{
cout << "Show the parameters " << myFile[i].addr << endl;
cout << hex << myFile[i].dst << dec << endl;
cout << myFile[i].size << endl;
for( unsigned int c = 0; c < myFile[i].path.size(); c++ )
cout << myFile[i].path[c] << " ";
cout << endl;
}
return 0;
}