Thread: odd I/O compile error

  1. #16
    Registered User
    Join Date
    May 2004
    Posts
    20
    The compiler says the opposite...

  2. #17
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >It is perfectly fine.
    How is that? The open member function for ifstream returns void, so you can't use the return value as a test for success. One would need to call the is_open member function to check the status.
    Code:
    ifstream winfilein("wins.txt"); // ios_base::in is defaulted
    
    if (winfilein.is_open()) {
      winfilein.close();
      // blahblah
    }
    My best code is written with the delete key.

  3. #18
    Registered User
    Join Date
    May 2004
    Posts
    20
    doh... it returns void?
    that would help, thx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  2. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM