Re: [Dev-C++] auxiliar funcition with Variable Argument List
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2005-12-17 02:37:10
|
Make a version of showMessage that takes a va_list instead of ellipsis.
void showMessage(int level,const char* message,va_list ap) {
printf("Level is %d\n",level);
printf("Message is '");
vprintf(message,ap);
printf("'\n");
}
void showMessage(int level,const char* message,...) {
va_list ap;
va_start(ap,message);
showMessage(level,message,ap);
va_end(ap);
}
void showMessage(const char* message,...) {
va_list ap;
va_start(ap,message);
showMessage(0,message,ap);
va_end(ap);
}
/Per W
On Wed, 14 Dec 2005, Minds Work wrote:
> Hi
> I Have a function with Variable Argument List, that work fine:
>
> void showMessage(int level, const char * message, ...);
>
> But now I want to make a similiar function
>
> void showMessage(const char * message, ...);
>
> that calls the first one, passing a default level argment, but I don't find
> a way to pass the Variable Argument List ( the ... ) from the new foo
> funtion to the old one...
> Is there a way to do this?
>
> []s
> Freddy
>
|