Thread: If/Ofstream

  1. #1
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269

    Angry If/Ofstream

    A thought to pondor: #include <fstream>
    will give me errors about if/ofstream not being declared, where as #include <fstream.h> does not (If I can get it to compile as a deprecated header fill )

    -SirCrono6
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  2. #2
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    Code:
    #include <fstream>
    using namespace std;
    OR:

    Code:
    #include <fstream>
    using std::ifstream;
    using std::ofstream;

  3. #3
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269

    Exclamation

    Thankyou! That worked, but now I'm using ios::nocreate too. I figured out using std::ios, but for the nocreate part it says: `nocreate' is not a member of type:

    Code:
    ifstream Read("Save.ini",ios::nocreate);
    OS: Windows ME
    Compiler: BloodShed Dev-C++ 4.9.8.0

    -SirCrono6
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  4. #4
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    ios::nocreate was removed from standard c++, you may use ios::in to open the file for reading, and not create one if it doesn't exist.
    The file shouldn't be created if you have a standard compliant compiler. (I think dc++ is)
    here is a list of the available flags:
    http://www.cppreference.com/cppio_de...tml#mode_flags

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing if/ofstream objects by reference
    By evilkillerfiggi in forum C++ Programming
    Replies: 3
    Last Post: 12-10-2005, 11:13 AM