int swprintf(wchar_t* wpBuffer, size_t uiBuffMax, const wchar_t* kwpFormatString, ...);
#include <cwchar> int main() { using namespace std; const unsigned int kuiMaxBuffer = 20; wchar_t waBuffer[kuiMaxBuffer + 1]; // Put a string in the buffer int iCharCount = swprintf(waBuffer, kuiMaxBuffer, L"%s", L"XoaX.net"); wprintf(L"%d characters were stored.\n", iCharCount); wprintf(L"The buffer holds: %s.\n", waBuffer); // Try to put too many characters in the buffer iCharCount = swprintf(waBuffer, kuiMaxBuffer, L"%s video tutorials", L"XoaX.net"); wprintf(L"%d characters were stored.\n", iCharCount); wprintf(L"The buffer holds: %s.\n", waBuffer); // Keep the window open until "Enter" is pressed getwchar(); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.