If data is fixed width, then splitting at the right place is really quite easy. Something along these lines:
std::string input;
int lineno = 0;
std::string compound;
std::vector<double> data;
while(std::getline(cin, input))
{
if (input[0] != ' ') // Detect new "first line"
{
lineno = 0;
}
else
{
lineno ++;
}
switch(lineno)
{
case 0:
{
if (data.size() != 0)
{
// Save "data" from previous "chunk".
}
data.clear();
int i;
for(i = 0; i < input.size() && input[i] != ' '; i++);
compound = input.substr(0, i);
// May want to keep comment too: comment = input.substr(i);
// You would have to strip extra spaces.
}
break;
case 1:
case 2:
{
// Not sure what you want to do here, as I don't
// know how the data is grouped. But should roughly follow
// the "default" variety.
}
break;
default:
{
const int fieldsize = 16;
for(int i = 6; i < input.size(); i += fieldsize)
{
data.push_back(std::stod(input.substr(i, fieldsize)));
}
}
break;
}
}