Jump to content
  • Advertisement
Sign in to follow this  
rmdeboer82

Passing Ellipses ('...') thru to another function

This topic is 3717 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'm looking for a way to pass '...' thru to another function, like:
void A(...)
{

}

void B(...)
{
 A(...)
}

Because vsscanf is not supported on non-Unix systems (Windows, VC++). How can I get around this? I found an intersting link which probably fixes this problem by copying stacks: http://www.codeproject.com/KB/tips/va_pass.aspx but I don't know nothing about templates. Is there a simple C(++) or assembly implementation for it (because that would be easier to understand for me)? I normally use sscanf to read doubles, strings and integers so there's no fixed size of the arguments. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Since you are using C++, do yourself a favor and stay far away from variable argument lists. I think the preferred method is to use streams like stringstream to get the same functionality.

As summed up by somebody's sig (I think it's in Zahlman's): When you invoke the dreaded ellipsis construct, you leave the happy world of type safety.

Share this post


Link to post
Share on other sites
Thanks Simian Man. The one you mentioned (by mgix) worked in my test application, however whenever I implement it in my game it will give a 0x000005 error.

I made one vsscanfwin32 myself based on the idea of Anuj Seth and Rainer Bauer but without the CString class. That one worked in my game.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mike.Popoloski
Since you are using C++, do yourself a favor and stay far away from variable argument lists. I think the preferred method is to use streams like stringstream to get the same functionality.

As summed up by somebody's sig (I think it's in Zahlman's): When you invoke the dreaded ellipsis construct, you leave the happy world of type safety.


::cough::. :) Thanks, SiCrane.

OP: What are you trying to do? I mean really? What would you do if ellipses were not part of the language? Why do you think ellipses will make this easier?

And for that matter, why would you be using sscanf() to read things in C++?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!