-
December 6th, 2003, 01:00 PM
#1
How to create a printf wrapper
I am trying to create a function like:
void my_printf(char *fmt, ...) which behaves like printf, except that it will also record all the argument passed in to a text file. Can anybody tell me how to do this?
Thanks.
-
December 6th, 2003, 01:34 PM
#2
My initial thought:
Call my_printf just like you would call printf. Inside of my_printf, use va_list, va_start, va_arg, and va_end to extract the var args. Do what you will with them. Then, call vprintf with the va_list.
You will know how many arguments were passed by the number of %'s (take %% into account, of course) in char* fmt...
Thought for the day/week/month/year:
Windows System Error 4006:
Replication with a nonconfigured partner is not allowed.
-
December 6th, 2003, 01:46 PM
#3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|