C Standard Libraries C++

wprintf()

Declaration

int wprintf(const wchar_t* kwpFormatString, ...);

Description

This function takes the wide character string given by "kwpFormatString" and its additional arguments and outputs it to the standard output stream, stdout. If successful, the function returns the number of characters written to the stream. Otherwise, it returns a negative value to indicate an error.

Example

#include <cwchar>

int main()
{
    const wchar_t kwaWideString[] = L"XoaX.net";

    // Output a formatted wide string
    int iCharWritten = wprintf(L"Name: %ws\n", kwaWideString);
    wprintf(L"Wrote %d characters\n", iCharWritten);

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

Output

wprintf() Output
 

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