Boost logo

Boost Users :

Subject: [Boost-users] Portable file I/O with system error codes support
From: Oleg Andriyanov (o.andriyanov_at_[hidden])
Date: 2017-08-23 16:07:50


I'm looking for a portable way to open a file, read some data from it,
and do a proper error reporting in case of error.

Apparently std::fstream is not suitable for this task because it does
not provide means to retrieve original error code or even some human
readable description of what went wrong (checking errno does not count
since the standard does not guarantee it is set by any functions in

I'm wondering if boost::iostreams can do that, but I've found nothing
this far that could help in getting the error code. I've also tried
boost::filesystem::fstream, but no luck.

Users of large frameworks like Qt have advantage of their portable
wrappers for file I/O like QFile. Are there any means in Boost which
provide similar functionality?

Related StackOverflow question:


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at