Hello World!
I'm new in the forum and I don't have too much experience with C++, I'm looking for help with my code, I hope you could help me :)
I have to read from a file.txt different collumns, each of them corresponds to a parameter and store them in a deque, I have found out how to read the first 3, but the problem comes with the last parameter, because is a vector that I have insert in the deque, let me show you:
My file would be something like this:
1 A0003 128 4,4,4
2 A0005 128 1,8,3,2
3 A0002 128 2,2
The 1st, 3rd and 4th collumns are int in dec but the 2nd is in HEX.
I have used something like:
std::istream ifs(parameter("file").stringValue(),std::ifstream::in);
myfile.clear();
ifs >> std::skipws;
while (!ifs.fail())
{
Entry e; // a class where I have my parameters
ifs >> src; if (ifs.fail()) break;
ifs >> src::setbase(16) >> e.dst; if (ifs.fail()) break;
ifs >> e.size; if (ifs.fail()) break;
ifs >> e.path; if (ifs.fail()) break;
}
ifs.close();
if (!ev.Disabled())
{
ev << "Show the parameters" << addr << endl;
for (std::deque<Entry>::iterator l = myfile.begin(); l != traces.end(); l++)
{
ev << "dst = " << std::hex << l ->dst
<< "size = " << l ->size
<< "path = " << l ->path // here it should show the content of the vector i.e. 4,4,4
<< endl;
}
}
How can I read from the file the vector and insert it on the deque to be able to take later each one of the values of the vector from the deque later???
Thanks in advance for your help :)