#include<iostream>
#include<fstream>
#include <sstream>
#include<string>
using namespace std;
void main()
{
std::ifstream fin("romanian.txt");
std::ofstream fout("output.txt");
std::string line;
int i;
int count=0;
string word;
while(!fin.eof())
{
getline(fin,line);
for(i=0;i<line.length();i++)
{
if(line[i]==' ')
{
break;
}
cout<<line;
}
}
system("PAUSE");
}
the prog get crashed ... can any one please give me help how to read first line from file the file is in format:
abc def
gef hij
sss fff
sdsdd fvf
output should be
abc
gef
sss
sdsdd
please i need help learning file handlng nw