C Standard Libraries C++

putwc()

Declaration

wint_t putwc(wchar_t wChar, FILE* qpStream);

Description

This function sends the wide-character "wChar" to the FILE stream argument that is passed in as "qpStream" 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
        putwc(*kwpCurrChar, stdout);
        ++kwpCurrChar;
    }
    // Output a final endline
    putwc(L'\n', stdout);

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

Output

putwc() Output
 

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