Created
May 16, 2017 18:35
-
-
Save tedz2usa/b34993a6a29abb74670bad8916a0571c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/questions/1056411/how-to-pass-variable-number-of-arguments-to-printf-sprintf | |
void Error(const char* format, ...) | |
{ | |
va_list argptr; | |
va_start(argptr, format); | |
vfprintf(stderr, format, argptr); | |
va_end(argptr); | |
} | |
If you want to manipulate the string before you display it and really do need it stored in a buffer first, please please please use vsnprintf instead of vsprintf. vsnprintf will prevent an accidental buffer overflow error. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment