[filesystem] Puzzling behaviour on MSVC 7.1 with ofstream and wpath in binary mode

Hello, My development platform is Win XP with sp2. I am using a very recent (no older than a week) copy of the boost cvs version 1.34rc and the compilers are MSVC 7.1 and 8.0 both with the service packs. I've encountered some puzzling behaviour with filesystem::wpath's and filesystem::ofstream's when opened in binary mode and compiled with VC++ 7.1. When I attempt to open a binary ofstream with a wpath as its filename it will fail if the file did not already exist. This appears to be contrary to when the filename argument is a narrow filesystem::path. When the binary mode is not specified both files are created. Attached is a very small app. demonstrating the inconsistency. This only occurs with 7.1, when compiled with 8.0 both files will be created if they did not already exist. Kind regards, Eoin. #include <iostream> #include <boost/filesystem/path.hpp> #include <boost/filesystem/fstream.hpp> namespace fs = boost::filesystem; int main() { fs::wpath wide_filename = L"./Wide.txt"; fs::path narrow_filename = "./Narrow.txt"; fs::ofstream wide_fs(wide_filename, fs::fstream::binary); std::cout << ((wide_fs.is_open()) ? "Wide file open." : "Wide file not open.") << std::endl; fs::ofstream narrow_fs(narrow_filename, fs::fstream::binary); std::cout << ((narrow_fs.is_open()) ? "Narrow file open." : "Narrow file not open.") << std::endl; return 0; }
participants (1)
-
Eoin