-
file reading
I have a problem using ifstream to read files. It works fine for reading smaller files up to 1mb but when i start reading larger ones of around 5 mb it doesnt read the whole file. It stops reading in the begining of the file.
This is what i do:
ifstream fin("C:/TEST.TXT");
if(!fin){
cerr<<"\nFile could not be opened!";
getch();
exit(1);
}
char ch;
do{
fin.get(ch);
//some other code
}while(!fin.eof());
fin.close();
Do you see the problem?
-
For file-input, I generally use strings rather than char =]
-
ifstream fin("C:/TEST.TXT");
is it compiling??
i have to do
ifstream fin("C:\\TEST.TXT");
-
I have already tried using strings but i still come across the same problem.