I don't see any mistake in your code, it works fine with me.
Ensure that the file you're trying to open exists.
But...
Technically this line displays incorrect information:
cout<<endl<<"File Not Found";
It's not because the file couldn't be opened, that the file automatically doesn't exist.
For example it could be that you try to open an existing file, but this fails because of certain circumstances, then the file exists, and you display "File not found" .
Last edited by tux4life; Jul 30th, 2009 at 7:09 am.
Reputation Points: 2125
Solved Threads: 243
Postaholic
Offline 2,105 posts
since Feb 2009