When im using fstream.h its giving an error with using namespace std, how ever when i use simple fstream without .h , it is not giving error but not reading the file, How can i use fstream object using fstream.h header file along with using namespace std? Your urgent response will be highly appreciated,
#include <iostream>
using namespace std;
#include<fstream.h> //giving error
fstream file;
char a[20];
int main()
{
file.open("doc.txt",ios::in);
while (file>>a)
{
cout<<a<<endl;
}
file.close();
}