Variable Arguments
I am trying to make a function that will have an interface like printf but I want to use the resulting string for my debugging stuff. I could use sprintf and pass the result, but it gets annoying to create a buffer and then call sprintf, and my debug function. My problem is that I don''t want to write a full function to do what sprintf does. Is there a way I can pass the whole argument list to sprintf. Or do you know of any other ways to do it. Thanks.
*** Triality ***
*** Triality ***
July 07, 2000 09:53 AM
//: wrapper for logging messages to output device//: bool debugout(const char *msg, ...) { va_list argList; char buffer[512] = { 0 }; va_start(argList, msg); vsprintf(buffer, msg, argList); va_end(argList); OutputDebugString(buffer); OutputDebugString("\n"); //: could also send to file or other device return false;}
Then use just like your using sprintf/printf ...!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement