Author |
Message |
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Wed Jan 21, 2009 12:52 pm Post subject: C: Passing an unknown number of parameters and pass them on |
|
|
|
|
I'm talking about some printf() style thing... Actually, I just want a function that receives some stuff, including a formatted string that will do some stuff, then do an actual printf with the parameters. So I don't even need to use those parameters, I'd just need to pass them back to the printf...
How would I do that?
I saw the printf header is declared like
printf(const char *, ...); |
I'm guessing I can do that to my functions too, but in the definition of the function, how do I 'receive' those ... and how could I throw them back in the printf?
No big deal if it's not possible, and if the solution involves like 100 lines of code, forget it
This is C, not C++ too. _________________ (Insert a bunch of dead links here) |
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Wed Jan 21, 2009 1:29 pm Post subject: |
|
|
|
|
Found this on google for variable arguments: http://www.cprogramming.com/tutorial/lesson17.html
Looks pretty simple, though I've not personally used it. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
|
Back to top |
|
|
Quan Chi2 Member of "Sexy Teenagers that Code" Group
Age:33 Gender: Joined: Mar 25 2005 Posts: 860 Location: NYC Offline
|
Posted: Sat Jan 24, 2009 3:11 am Post subject: |
|
|
|
|
Ah... You beat me to it, Brain. I was reading that in school with a friend. |
|
Back to top |
|
|
|