This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/36564] New: reading from std::ifstream( directory ) ...
- From: "pluto at agmk dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Jun 2008 10:52:15 -0000
- Subject: [Bug libstdc++/36564] New: reading from std::ifstream( directory ) ...
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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