C Standard Libraries C++

putwchar()

Declaration

wint_t putwchar(wchar_t wChar);

Description

This function sends the wide-character "wChar" to the standard output stream "stdout" and returns the value of "wChar" to indicate success or WEOF to indicate an error or end-of-file condition. To check the error or end-of-file condition, use ferror() or feof().

Example

#include <cwchar>

int main()
{
    using namespace std;
    const wchar_t* kwpName = L"XoaX.txt";

    const wchar_t* kwpCurrChar = kwpName;
    while (*kwpCurrChar != L'\0') {
        // Send a wide character in the string for output
        putwchar(*kwpCurrChar);
        ++kwpCurrChar;
    }
    // Output a final endline
    putwchar(L'\n');

    // Keep the window open until "Enter" is pressed
    getwchar();
    return 0;
}

Output

putwchar() Output
 

© 2007–2022 XoaX.net LLC. All rights reserved.