Jump to content
  • Advertisement

Archived

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

logout

paramenter . . . .

This topic is 5674 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!