0

I have problem with parsing data from file to some arrays.

I need something like read line by line and parsing.

File is csv file separated by ;

data;data2;data3;date

void Parsing(ifstream &fileForParsing, int id[], string array1[], string array2[], int NumberOfLines){
string line;
while(!fileForParsing.eof())
    {
        //???
        cout<<line<<endl;
    }
}
Jiri Hlavik
  • 21
  • 1
  • 5

1 Answers1

0

Reading a file line by line could be done using std::getline

For splitting the string up I refer to this question: Parse (split) a string in C++ using string delimiter (standard C++)

Edit: Here is another helpful question: Split a string in C++?

I understand that your question is about parsing CSV Files (so first splitting up the file into lines and then the lines into fields). But please try to solve the subproblems separately, because all of them are already answered here.

Community
  • 1
  • 1
flowit
  • 1,382
  • 1
  • 10
  • 36