Click here to Skip to main content
15,886,026 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Receive UDP packet from multiple default gateway Pin
Shanky426-Mar-14 7:29
Shanky426-Mar-14 7:29 
QuestionADO Connection ptr under Windows 7 fails in Windowx XP Pin
aaandrei26-Mar-14 4:55
aaandrei26-Mar-14 4:55 
AnswerRe: ADO Connection ptr under Windows 7 fails in Windowx XP Pin
Jochen Arndt26-Mar-14 5:07
professionalJochen Arndt26-Mar-14 5:07 
QuestionHow to use global hook with WH_GETMESSAGE Pin
cedricvictor26-Mar-14 2:44
cedricvictor26-Mar-14 2:44 
AnswerRe: How to use global hook with WH_GETMESSAGE Pin
Richard MacCutchan26-Mar-14 5:26
mveRichard MacCutchan26-Mar-14 5:26 
GeneralRe: How to use global hook with WH_GETMESSAGE Pin
cedricvictor26-Mar-14 16:57
cedricvictor26-Mar-14 16:57 
GeneralRe: How to use global hook with WH_GETMESSAGE Pin
Richard MacCutchan26-Mar-14 22:52
mveRichard MacCutchan26-Mar-14 22:52 
Questionstd::wcout can't print out Arabic chars and some mathmatical symbols Pin
Falconapollo25-Mar-14 23:59
Falconapollo25-Mar-14 23:59 
Recently I want to find a general solution for std::wcout so that it can print out all unicode strings. but, after poking around on google, i can't find useful. I'm stuck here, anybody can help me?
_setmode(_fileno(stdout), _O_U16TEXT); won't work as expected.


Here is my current code snippet:
C++
        auto previousMode = _setmode(_fileno(stdout), _O_U16TEXT);
std::wifstream wifs;
wifs.imbue(std::locale(wifs.getloc(), new std::codecvt_utf16<wchar_t, 0x10ffff,
    std::codecvt_mode(std::little_endian | std::consume_header)>));
wifs.open(L"F:\\重要网址.txt", std::ios_base::binary);

std::wstring line;
std::getline(wifs, line);

wcout << line << endl;
wifs.close();

wcout << endl;
cout << "∦" << endl;

std::wofstream wofs;
wofs.imbue(std::locale(wifs.getloc(), new std::codecvt_utf16<wchar_t, 0x10ffff,
    std::codecvt_mode(std::little_endian | std::consume_header)>));
wofs.open(L"F:\\iMoney.txt", std::ios_base::binary | std::ios_base::ate);
wofs << line << endl;
wofs.close();
//it's important to restore mode to previous, otherwise std::cout will cause crash
_setmode(_fileno(stdout), previousMode);


and here is some symbols to test your slution before post here:
∀, ∁, ∂, ∅, ∰, ∵, ∺, ⊙, ⋾, ⋻, ⋱, ⋭, ⋣, ⋧
Arabic: لطيفة الطقس اليوم

modified 26-Mar-14 6:16am.

QuestionWhich among following statements c/c++ code is faster? Pin
shaktikanta24-Mar-14 22:59
shaktikanta24-Mar-14 22:59 
AnswerRe: Which among following statements c/c++ code is faster? Pin
Jochen Arndt25-Mar-14 0:20
professionalJochen Arndt25-Mar-14 0:20 
GeneralRe: Which among following statements c/c++ code is faster? Pin
Heng Xiangzhong10-Apr-14 1:19
Heng Xiangzhong10-Apr-14 1:19 
AnswerRe: Which among following statements c/c++ code is faster? Pin
Maximilien25-Mar-14 1:01
Maximilien25-Mar-14 1:01 
GeneralRe: Which among following statements c/c++ code is faster? Pin
shaktikanta25-Mar-14 3:18
shaktikanta25-Mar-14 3:18 
GeneralRe: Which among following statements c/c++ code is faster? Pin
Maximilien25-Mar-14 3:32
Maximilien25-Mar-14 3:32 
GeneralRe: Which among following statements c/c++ code is faster? Pin
jschell25-Mar-14 13:26
jschell25-Mar-14 13:26 
JokeRe: Which among following statements c/c++ code is faster? Pin
Rage25-Mar-14 2:20
professionalRage25-Mar-14 2:20 
AnswerRe: Which among following statements c/c++ code is faster? Pin
Albert Holguin25-Mar-14 4:42
professionalAlbert Holguin25-Mar-14 4:42 
AnswerRe: Which among following statements c/c++ code is faster? Pin
ptse26-Mar-14 3:34
ptse26-Mar-14 3:34 
GeneralRe: Which among following statements c/c++ code is faster? Pin
Richard MacCutchan26-Mar-14 5:24
mveRichard MacCutchan26-Mar-14 5:24 
QuestionFree fails with access violation Pin
tejaswini_g24-Mar-14 16:14
tejaswini_g24-Mar-14 16:14 
AnswerRe: Free fails with access violation Pin
Richard MacCutchan24-Mar-14 22:52
mveRichard MacCutchan24-Mar-14 22:52 
AnswerRe: Free fails with access violation Pin
Richard Andrew x6425-Mar-14 5:59
professionalRichard Andrew x6425-Mar-14 5:59 
AnswerRe: Free fails with access violation Pin
leon de boer25-Mar-14 17:36
leon de boer25-Mar-14 17:36 
AnswerRe: Free fails with access violation Pin
User 5924125-Mar-14 20:13
User 5924125-Mar-14 20:13 
GeneralDirectShow GraphEdit missing property page options tab. PARTIALLY SOLVED - CLOSED Pin
Vaclav_24-Mar-14 15:42
Vaclav_24-Mar-14 15:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.