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

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

include

using std::ifstream;
using std::ofstream;
[/code]

or this
[code]

inclue
include

int main()
{
std::ifstream fin;
std::ofstream fout;
}
[/code]

Jump to Post

All 2 Replies

Re: input output in regards to dev c++ vs xcode 80 80

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
Re: input output in regards to dev c++ vs xcode 80 80

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.