I have written the following code to represent a Unicode-based character at console output of windows but when I run the code, VS shows me an error with the following information:

Debug Assertation Failed

Expression: buffer_size % 2 == 0

My Code:

#include <iostream>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>

auto main() -> decltype(0) {
    bool status = _setmode(_fileno(stdout), _O_U16TEXT);

    if (status == true)
    {
        std::cout << "Everything is working fine." << std::endl;
    }

    wchar_t Message[] = L"\x263a";
    std::cout << Message << std::endl;

    return 0;
}

0 Answers