Code:
// reading a text file
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
string line;
ifstream myfile ("example1.txt");
ofstream myargument ("putonqueue.txt",ios::out | ios::app);
if (myfile.is_open())
{
while (! myfile.eof() )
{
// expects either space-delimited numbers
while( getline(myfile,line) ) {
istringstream ss (line);
double d;
while( ss >> d ) {
cout << " got a number: " << d << endl;
}
}
}
myfile.close();
myargument.close();
}
else cout << "Unable to open file";
return 0;
}
Hi I am trying to parse a text file in c++.The above code gives a compiler error:
argque.cpp: In function `int main()':
argque.cpp:20: error: variable `std::istringstream ss' has initializer but incomplete type
what does it mean?
any help or insight is appreciated.
Thanks
shweta