I have a data file that can be of any size and the entries look like this:
integerID
stringName
integerNum doubleVal1 doubleVal2
There can be any number of the blocks of data above that need to be parsed into 5 parallel vectors. I know that if I were adding the elements to an array, I would just use a for loop since I would know the array size and add the elements in accordingly. However, since the vectors in parallel can be any size, I do not know how to do it.
I know this doesn't work, but I am not sure how I am supposed to read the data to the vectors and I can't find an example that I understand for the life of me.Code:void readData(ifstream& inp, int integerID[], string stringName[], int integerNum[], double doubleVal1[], double doubleVal2[]) { inp >> integerID.push_back() >> stringName.push_back() >> integerNum.push_back() >> doubleVal1.push_back() >> doubleVal2.push_back(); }
Thanks in advance for any advice.
Rob



LinkBack URL
About LinkBacks



I used to be an adventurer like you... then I took an arrow to the knee.