I have a problem with code that is using _wfopen() on Windows. Should it
work with MSYS2? I have the following code that fails:

  std::string aFileName = "E:/Some/File.txt";
  std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> converter;
  std::wstring vFileName = converter.from_bytes();
  FILE *in_stream = _wfopen(vFileName.c_str(), L"rb");
  // in_stream is NULL here

The same code with fopen() on the original std::string works:
  std::string aFileName = "E:/Some/File.txt";
  FILE *in_stream = fopen(aFileName.c_str(), "rb");
  // in_stream is an open file here

Is that to be expected, or am I doing something wrong?

All the best,

    Mario Emmenlauer

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Msys2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/msys2-users

Reply via email to