I want to parse a file which describes a set of data line by line. Each datum consists of 3 or four parameters: int int float (optional) string.
I opened file as ifstream inFile and used it in a while loop
while (inFile) {
    string line;
    getline(inFile,line);
    istringstream iss(line);
    char strInput[256];
    iss >> strInput;
    int i = atoi(strInput);
    iss >> strInput;
    int j = atoi(strInput);
    iss >> strInput;
    float k = atoi(strInput);
    iss >> strInput;
    cout << i << j << k << strInput << endl;*/
}
The problem is that the last parameter is optional, so I'll probably run into errors when it is not present. How can i check in advance how many parameters are given for each datum?
Furthermore,
    string line;
    getline(inFile,line);
    istringstream iss(line);
seems a bit reduldant, how could I simplyfiy it?
 
     
     
    