I am declaring a local buffer of a fixed size in my variable argument
routine. How do I figure out the correct size of the variable argument list
so that I can dynamically allocate the memory?
void disp_message(ch ar *szCaption, char *szFormat, ...)
{
va_list ap;
char szBuffer[4096] = { 0 };
va_start(ap, szFormat);
vsprintf(szBuff er, szFormat, ap);
va_end(ap);
// Display the message.
MessageBox(NULL , szBuffer, szCaption, MB_OK | MB_ICONWARNING) ;
}
routine. How do I figure out the correct size of the variable argument list
so that I can dynamically allocate the memory?
void disp_message(ch ar *szCaption, char *szFormat, ...)
{
va_list ap;
char szBuffer[4096] = { 0 };
va_start(ap, szFormat);
vsprintf(szBuff er, szFormat, ap);
va_end(ap);
// Display the message.
MessageBox(NULL , szBuffer, szCaption, MB_OK | MB_ICONWARNING) ;
}
Comment