#include <iostream>
#include "stdarg.h"
using namespace std;
void TestFun(const char* pszFormat, ...)
{
char strBuffer[50];
char *strBuffer2 = new char[50];
va_list args;
va_start(args, pszFormat);
_vsnprintf(strBuffer, 50, pszFormat, args);
strBuffer2 =va_arg( args, char *);//指向下一个参数
va_end(args);
cout<<strBuffer<<endl;
cout<<strBuffer2<<endl;
}
int main()
{
TestFun("hello", "world");
system("pause");
return 0;
}
#include "stdarg.h"
using namespace std;
void TestFun(const char* pszFormat, ...)
{
char strBuffer[50];
char *strBuffer2 = new char[50];
va_list args;
va_start(args, pszFormat);
_vsnprintf(strBuffer, 50, pszFormat, args);
strBuffer2 =va_arg( args, char *);//指向下一个参数
va_end(args);
cout<<strBuffer<<endl;
cout<<strBuffer2<<endl;
}
int main()
{
TestFun("hello", "world");
system("pause");
return 0;
}