file_stdio::open currently only accepts a char const* path. Recently I had a std::filesystem::path and wanted to call file_stdio::open, noticed that I had to do mypath.c_str() to make it compile, briefly thought "hm that's a bit weird", but it worked and I didn't think further about it.
Then a week later, I noticed my code no longer compiled on Windows, because there, mypath.c_str() returns wchar_t const*(!). For the time being I made the compiler shut up by doing mypath.string().c_str(), but I'm not even sure that's correct, and really, it just made me wonder why Beast is doing this to me. :-)
Update: I see file_stdio::open specifically requires UTF-8, so maybe I should be using reinterpret_cast<char const *>(mypath.u8string().c_str())? If so, that's not the most ergonomic API for opening a file specified by a std::filesystem::path.
file_stdio::opencurrently only accepts achar const* path. Recently I had a std::filesystem::path and wanted to callfile_stdio::open, noticed that I had to domypath.c_str()to make it compile, briefly thought "hm that's a bit weird", but it worked and I didn't think further about it.Then a week later, I noticed my code no longer compiled on Windows, because there,
mypath.c_str()returnswchar_t const*(!). For the time being I made the compiler shut up by doingmypath.string().c_str(), but I'm not even sure that's correct, and really, it just made me wonder why Beast is doing this to me. :-)Update: I see
file_stdio::openspecifically requires UTF-8, so maybe I should be usingreinterpret_cast<char const *>(mypath.u8string().c_str())? If so, that's not the most ergonomic API for opening a file specified by a std::filesystem::path.