Reading wide character output from child process on Windows

152 Views Asked by At

My application has to run on Windows and uses the unicode character set. When I try to read the output with the following commands I get only scrambled output, however replacing all types with the char_t equivalents works unless there are characters that the current code page doesn't support. Does anybody know why the wchar_t variant doesn't seem to work at all and how it can be fixed?

boost::process::wipstream outStream;
std::wstring wcmd = L"dir";
boost::process::child process(wcmd, boost::process::std_out > outStream);
std::wstring line;
std::vector<std::wstring> lines;
while ((process.running()) && (std::getline(outStream, line)))
{
    lines.push_back(line);
}
0

There are 0 best solutions below