# 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.

## 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 on other sites
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 on other sites
There are a bunch of WIn32 implementations around like this.

##### 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 on other sites
Quote:
 Original post by Mike.PopoloskiSince 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++?

1. 1
2. 2
Rutin
20
3. 3
4. 4
frob
13
5. 5

• 9
• 13
• 10
• 9
• 17
• ### Forum Statistics

• Total Topics
632601
• Total Posts
3007358

×