Original Post
🔒 Locked
Variable argument Macro
Advertisement
I don't quite understand your question. Is it that you need to create functions with variable arguments and don't know how? If that's the case, look at this OpenGL tutorial on NeHe: click. Take a look at the glPrint function. In it he uses variable arguments. This is how I learned. You will need stdarg.h. If you need further help, consult that msdn pages or post some more. Sorry if this isn't what you needed.
It's not a part of standard C++, nor is it in C89, but I think C99 may have some support for it(not a lot of compilers supporting C99 out there, though). GCC lets you define variadic macros like this:
#define PRINTF_DEBUG( format, args...) xprintf( putc_debug, format, args )
VC++ does not, to my knowledge, have any support for variadic macros.
#define PRINTF_DEBUG( format, args...) xprintf( putc_debug, format, args )
VC++ does not, to my knowledge, have any support for variadic macros.
err... i just want a to make a macro that uses swprintf and _scwprintf, but you would only have to write it in once...
something like:
where args could be multiple arguments...
something like:
PString result = new String ( false, _scwprintf ( formatstring, args ) );swprintf ( *result, formatstring, args );where args could be multiple arguments...
Variadic macros are also standard in C; the syntax has been given so I don't need to go into that.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement