C Standard Libraries C++

vfwprintf()

Declaration

int vfwprintf(FILE* qpStream,
              const wchar_t* kwpFormatString,
              va_list qArgList);

Description

This function sends the formatted wide-character string given by "kwpFormatString" and the variable argument list "qArgList" to the stream "qpStream." The function returns the number of characters written to the stream, if the function call is successful. Otherwise, it returns -1 to indicate an error.

Example

#include <cwchar>
#include <cstdarg>

int OutputArgs(FILE* qpStream, wchar_t* wpFormatString, ...) {
    va_list qArgList;
    va_start(qArgList, wpFormatString);
    int iReturn = vfwprintf(qpStream, wpFormatString, qArgList);
    va_end(qArgList);
    return iReturn;
}

int main()
{
    // Output an int, a string and a float to stdout
    int iWritten = OutputArgs(stdout, L"%d %ws %f \n",
        8, L"XoaX.net", 3.141593);
    wprintf(L"%d characters written.\n", iWritten);

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

Output

vfwprintf() Output
 

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