• Advertisement

Archived

This topic is now archived and is closed to further replies.

paramenter . . . .

This topic is 5492 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering how i can create functions that use the ... as a paramenter _ like vMyFunc(char *szName, ...); like sprintf/printf (and the rest of that lot )

Share this post


Link to post
Share on other sites
Advertisement
Try this:


  
#include <stdarg.h>

void vMyFunc(char *fmt,...)
{
va_list args;
char text[1024];

va_start(args,fmt);
vsprintf(text,fmt,args);
va_end(args);

// do something with text

}


You can do other stuff with va_lists. Take a look at your compiler help files/man pages.

Share this post


Link to post
Share on other sites

  • Advertisement