I am developing a search engine which needs to search big text files and have just started with c++.
When reading a file I wud like to know which of the following method is faster for reading from big text files.
1.reading line by line
OrCode:ifstream myfile ("c:\\hello.txt");
while (! myfile.eof() )
{
getline (myfile,line);
cout << line << endl;
}
2.streaming everything
I would go for second method but just to get an opinion.... is there any faster(efficient) way of reading text from the file than the methods mentioned above.Code:while(myfile >> line){
stringstream os(line);
cout<<line;
}
Thanks.