Jump to content
  • Advertisement
Sign in to follow this  
OpenGL_Guru

iostream and fstream

This topic is 4626 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am into .NET now and i am switch ing from iostream.h/fstream.h to just iostream and fstream. when i try to declare something like.. ifstream infile; the compiler doesnt like these ... ofstream outfile; what is the common includes and/or declarations for this? thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
ifstream and ofstream are both defined in the <fstream> header. Just remember that they live in the std namespace so you'll either need to say std::ifstream/std:ofstream or use a using directive or declaration.

Share this post


Link to post
Share on other sites
Prefix with the std namespace:

std::ifstream infile;
std::ofstream outfile;

The main difference between the <xxx.h> and <xxx> is that the classes are declared
to reside in the std namespace.

[edit]Too slow[smile][/edit]

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
ifstream and ofstream are both defined in the <fstream> header. Just remember that they live in the std namespace so you'll either need to say std::ifstream/std:ofstream or use a using directive or declaration.


thanks...

i wasnt including using namespace std at the top... duh.. :=/

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!