00001 00008 #include "winsupport.h" 00009 00010 #ifdef _WIN32 00011 00012 #include <stdio.h> 00013 #include <malloc.h> 00014 00015 int _asprintf(char** buf, const char* format, ...) 00016 { 00017 va_list ap; 00018 int len; 00019 int res; 00020 00021 va_start(ap, format); 00022 /* _vscprintf doesn't count the 00023 * null terminating string so we add 1. */ 00024 //len = _vscprintf_p( format, ap ) + 1; //TODO: fix error on this line when compiled with mingw 00025 *buf = (char*)malloc(len*sizeof(char)); 00026 //res = _vsprintf_p(*buf, len, format, ap); //TODO: fix error on this line when compiled with mingw 00027 va_end(ap); 00028 00029 return res; 00030 } 00031 #endif