Original Post
I''ve got a class that maintains an error log. Currently, if I want to record the value of some variable, I have to first declare an array to store a string, then use sprintf() to load that string with the data I want, then pass the string to my error-recording function.
That''s not cool. Instead, it would be a lot better if my error-recording function worked similarilly to the sprintf() line of functions. However, I''m having a lot of trouble getting this to work.
At the core of it, all I''m trying to do here is to create a wrapper function for sprintf. I''m including stdarg.h, and I''ve declared my function with the function(char * s, ...); syntax.
However, I can''t figure out how to define that function so that it calls sprintf with the information it has been given. Is there any easy way to do this? Or am I going to have to write a function that performs the same string-parsing work as sprintf does?