more detailed io state; new_handler and thread safety

Benjamin Kosnik bkoz@redhat.com
Thu Apr 4 12:23:00 GMT 2002


> 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)
  
> 2.) I found no clear statement in my literature about
> the thread safety of std::set_new_handler but I suspect
> it is not thread safe. What is an approved way of having
> several threads with each having their own new_handler
> function set?

I don't know. It's a good question though.

-benjamin



More information about the Libstdc++ mailing list