I am writing C++ in MSVC for Windows. I need to use std::wifstream instead std::ifstream so that I can open files with "Windows Unicode" (i.e., wchar_t[]) path.
However, this class has only one binary reading method, that is:
std::wistream& read (wchar_t* s, streamsize n);
So how can I read a single byte/char with this class?
Update with solutions:
Thank you all for your suggestions, I didn't know that ifstream constructors accept wchar_t[] as file name. Based on your information, I came up with 2 solutions that works:
std::ifstream file(L"...");
std::ifstream file(std::filesystem::path(L"..."));
Solution 1 would be more prefered as solution 2 only works under c++20;