[C++] wstringでエンコードされたデータをファイルに書き込む 投稿日: 2020年4月17日 投稿者: kaizawa wstring の場合 #include <iostream> #include <fstream> int main() { std::wstring text(L"hello, world"); std::basic_ofstream<wchar_t> ofs("C:\\hoge1.txt", std::ios::binary); ofs.write(text.data(), text.size()); }