How does printf work?
Hi, me again..
I have a class (the language is C++) that has a function used for putting text into a logfile. Loghandler::log(const char *text); This works out but now I need a more powerful way to do this. I need to be able to send variables as arguments, like you do to printf(). Loghandler::log(const char *format, ...); I tried and using ... as type worked, the compiling worked. But how can I manage this? Can I do a function that works like printf and then use it to log the whole, processed string? |
Code:
NAME You're doing right by using ... in the parameter list. the va_*() functions just let you pull those arguments off the stack. |
All times are GMT -5. The time now is 04:07 AM. |