This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: more detailed io state; new_handler and thread safety


On Thu, Apr 04, 2002 at 11:36:22AM -0800, Benjamin Kosnik wrote:
> 
> > 1.) How can I determine what caused a stream to get
> > the ios_base::failbit or ios_base::badbit?
> > E.g. how can I find out if opening a file failed due
> > to permission problems?
> 
> You could check for state after open.
> 
>   std::ifstream ifs1;
>   ifs1.open(name_01);
>   if (ifs1.rdstate() == std::ios_base::failbit)
>   

Well, if I read this right, this tells me that *SOMETHING* went
wrong while opening the file. But I'd like to know whether the
error arose due to a wrong file permissions, or maybe the file
doesn't exist or whatever. How do I get this out of the "failbit"?

matthias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]