Thread: Why would ifstream::getline hang and not return?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Programming Ninja In-T...
    Join Date
    May 2009
    Posts
    827

    Why would ifstream::getline hang and not return?

    I encountered a situation where istream::getline() hangs, and does not return.
    Why would this be?

    Code:
    bool CfileOperations::readLine(char buffer[], streamsize bufferSize) {
    
        filestreamInObject.getline(buffer, bufferSize);
        if (filestreamInObject.good()) { //no error flags set
            return true;
        }
    
        else {
            return false;
        }
    
    }
    filestreamInObject is an object of ifstream.
    Last edited by Programmer_P; 07-16-2010 at 07:34 AM.
    I'm an alien from another world. Planet Earth is only my vacation home, and I'm not liking it.

Popular pages Recent additions subscribe to a feed