troubleshooting Question

Detecing an empty va_list?

Avatar of _Stilgar_
_Stilgar_Flag for Israel asked on
CC++Editors IDEs
3 Comments1 Solution2372 ViewsLast Modified:
Hi all,

I have a function that accepts an LPCTSTR. I want to add functionality to parameterized strings - that is, to have the LPCTSTR go through _vsntprint - but since it requires copying the string to a buffer, or making the current buffer larger, I want to call it only if the parameters list is not empty. I would want to use the same function I do now, without creating another version of it which accepts an ellipsis.

So, if my function looks like this: int Execute (LPCTSTR command) , I want it to look like this: int Execute (LPCTSTR command, ...). I'm then using va_start, but couldn't figure out how to see if it points to an empty parameters list or not. I'm not even sure using va_arg is possible for testing this (of course I will have to do va_list args-- after calling it). Passing an int with parameters count is not an option.

Any advice on how to do this (if at all possible)?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros