so for my computing project we have just started to work with using input and output of text files, the tutorial my teacher gave said to include these libraries, which i did

#inclue <fstream>
#include <iomanip>

and explains how to use

ifstream fin;  //fin is my file input variable
  		  ofstream  fout;  //fout is my file output variable

the problem is dev c++ doesnt seem to recognize this, my teacher works with xcode so is that whats messing this up? or does my version need an update or something? or does dev do this a different way than xcode? sorry this is kind of a dumb question but dumb questions are easily answered

Recommended Answers

All 2 Replies

you have to tell the compiler that ifstream and ofstream are in std namespace. There are a couple ways to do that

#include <fstream>

using std::ifstream;
using std::ofstream;

or this

#inclue <fstream>
#include <iomanip>

int main()
{
   std::ifstream fin;
   std::ofstream fout;
}
commented: think that did the trick thanks! +1

you have to tell the compiler that ifstream and ofstream are in std namespace. There are a couple ways to do that

#include <fstream>

using std::ifstream;
using std::ofstream;

or this

#inclue <fstream>
#include <iomanip>

int main()
{
   std::ifstream fin;
   std::ofstream fout;
}

perfect! works fine now thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.