no output with wide streams

77 views Asked by At

I have a problem with wide stream output. My primary concern is wofstream but wcout doesn't work properly either. So it doesn't produce output besides Latin characters. That is

#include <string>
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
wstring wstr = L"Андрей";
wofstream fout(L"C:\\Work\\report.htm");
wcout << wstr << L"Привет мир";
fout << wstr << L"Привет мир";
fout.close();
}

Produces no output, the file stays 0 byte long.

Mixing like wcout<<L"zuhщзг" prints just "zuh", ignores the rest.

I use MVS 2013 with Intel C++ Composer 14.0

EDIT: Windows Unicode C++ Stream Output Failure describes similar problem. But I don't quite understand how the solution works. MVS/Windows use UTF-16 for wide strings. and I would like they to be written in the file, as is, that is utf-16, without any unnecessary conversion

0

There are 0 answers