Thread: File I/O: ios has not been declared?

  1. #1
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476

    File I/O: ios has not been declared?

    I don't know what's wrong. I've included "fstream" and "iostream", but the compiler said 'ios' has not been declared? Here's the faulty code:

    Code:
    	std::ofstream binary_file("settings.dat",ios::out|ios::binary);
    	binary_file.write(reinterpret_cast<char *>(&mData),sizeof(SettingData));
    	binary_file.close();
    What's wrong with it?

  2. #2
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Nevermind that. I've forgotten to add std namespace. Silly me. Sorry for the bogus question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  3. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  4. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  5. Nested loop frustration
    By caroundw5h in forum C Programming
    Replies: 14
    Last Post: 03-15-2004, 09:45 PM