i'm looking for clarification about such code snippet:

$ cat test.cpp
#include <fstream>
#include <iostream>
#include <string>

int main()
{
        std::ifstream in( "/tmp" );
        if ( in.good() )
        {
                std::cerr << "good()" << std::endl;
                std::string buf;
                while ( std::getline( in, buf ) )
                        std::cout << buf << std::endl;
        }
}

on the linux/unix system makes no difference between a file and a directory,
since a directory is just a file containing names of other files.
libc.read returns an error -EISDIR so how the ifstream should behave?


-- 
           Summary: reading from std::ifstream( directory ) ...
           Product: gcc
           Version: 4.2.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
GCC target triplet: *-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36564

Reply via email to