Boost logo

Boost Users :

Subject: [Boost-users] boost filesystem
From: John Emmas (johne53_at_[hidden])
Date: 2012-01-23 11:12:07

Hello, I hope someone here will be able to help with this. Sorry, but the background is a little long-winded....

I've just discovered to my dismay that Microsoft's implementation of fstream, ifstream and ofstream are fatally flawed. I'm not sure if these characters will display correctly across this mailing list but consider the following character set:-


which is apparently the Greek name "Dimitris". In an English locale, the following path would only be considered valid (by Windows) in a Unicode environment:-


That's fine - because the user name doesn't contain valid English characters. However in Greece, that same path should qualify as a valid, non-Unicode file path and should therefore be openable without needing Unicode. For example, when building with MSVC this works:-

#include <fcntl>

      int file = _open("C:/Users/ΔΗΜΗΤΡΗΣ/some_file_name", _O_RDONLY);

However, this fails to work - even though it uses the same path:-

#include <fstream>
using std::fsrream;

      fstream file("C:/Users/ΔΗΜΗΤΡΗΣ/some_file_name", fstream::in | fstream::out);

To cut a long story short, I noticed that libboost offers its own 'filesystem' implementation. Does boost::filesystem implement its own fstream, ifstream and ofstream? If so, would they likely suffer from the same problem (on Windows). If not, where can I find some examples of using boost::filesystem? Thanks,


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