{I+=codeWee;}
[C++] string Formatting : Function(char * format, ...);
#include <stdlib.h>
#include <stdarg.h>

void test(char * format, ...)
{
	va_list args;
	int len;
	char * buffer;

	va_start(args, format);
	len = _vscprintf(format, args) + 1;
	buffer = (char*)malloc(len * sizeof(char));
	vsprintf_s(buffer, len, format, args);
	va_end(args);

	//....

	free(buffer);
}

void test(wchar_t * format, ...)
{
	va_list args;
	int len;
	wchar_t * buffer;

	va_start(args, format);
	len = _vscwprintf(format, args) + 1;
	buffer = (wchar_t*)malloc(len * sizeof(wchar_t));
	vswprintf_s(buffer, len, format, args);
	va_end(args);

	//...

	free(buffer);
}
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.