Presumably each line is processed individually, in which case you can simply read a line at a time and then parse it. As an example, this program would echo the file to stdout:
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
int main()
{
std::ifstream in("file");
if (in) {
std::string line;
while (std::getline(in, line)) {
// Parse the line using a string stream
std::istringstream row(line);
double field;
while (row>> field)
std::cout<< field <<'\t';
std::cout<<'\n';
}
}
}
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401