asprintf for VSAuthor: Dave Date: 03.14.14 - 5:53pm here is a quick implementation of asprintf for Visual Studio. rather annoying they dont include this by default..
#include <stdarg.h>
char* asprintf(char* format, ...){
char *ret = 0;
if(!format) return 0;
va_list args;
va_start(args,format);
int size = _vscprintf(format, args);
if(size > 0){
size++; //for null
ret = (char*)malloc(size+2);
if(ret) _vsnprintf(ret, size, format, args);
}
va_end(args);
return ret;
}
Comments: (0) |
About Me More Blogs Main Site
|
||||||||||||||||||||||||||||||||||||||||||