// Repeated Code through out my files.
szTemp[128];
sprintf(szTemp,"Value1 %d Value2 %d",value1, value2);
DebugOutput(szTemp);
Is it possible to mimick the 3 lines into one line and a seperate function...
// My New function
DebugPrintf("Value1 %d Value2 %d",value1, value2);
// In my Library...
void DebugPrintf(const char *format, ... )
{
char szTemp[MAX_PATH];
// The below line doesnt work off course
//
// How do I parse ... from above into sprintf below?
//
sprintf(szTemp,format,...);
DebugOutput(szTemp);
}
try this code. it works for me. I didn''t come up with it, but saw it on a tutorial on gamasutra I think. It writes the text out to a file using vfprintf, but i''m sure there is a version of sprintf (maybe vsprintf) that works like this: