Please help me!!!! Working with files

I don't know why am I getting this problem I use devcpp v5.5.1
The error is: [Error] fstream.h: No such file or directory

#include<iostream>
#include<fstream.h> //This is the line where im getting error
#include<conio.h>
using std :: cout;
using std :: cin;
int main()
{
char line[80];
ofstream fout;
fout.open("Country.txt");
fout<<"United States of America \n United Kingdom \n South Korea \n India \n Australia";
fout.close();
fout.open("Capital.txt");
fout<<"Washington \n London \n Seoul \n Dehli \n Canberra";
fout.close();
ifstream fin;
fin.open("Country.txt");
cout<<"\n Countries:";
while(!fin.eof())
{
fin.getline(line,80);
cout<<"\n"<<line;
}
fin.close();
fin.open("Capital.txt");
cout<<"\n Capital of above Countries:";
while(!fin.eof())
{
fin.getline(line,80);
cout<<"\n"<<line;
}
fin.close();
getch();
}
Try #include <fstream> (without the ".h")
I tried then I get more errors
[Error] 'ofstream' was not declared in this scope
thats because you need to do: using std::ofstream. as a general rule if it is in the stl then it is in the std namespace and you need to use either using std::the_object_or_class or you can do std::the_object_or_class_when_called
Can u re write post it please
I got it thanks a lot
Topic archived. No new replies allowed.