Advertisement

passing va_list as an argument...

Started by July 01, 2001 03:49 PM
1 comment, last by Harvester 23 years, 7 months ago
Greets. I have a function that takes a variable number of arguments (va_list). I want this function to send all the arguments, as received to another function, that also accepts a variable number of arguments (va_list). What i tried was:
  
int func1(char *something, ...){
 va_list v1;
 va_start(something, v1);
 func2(something, v1);
 va_end(v1);

 return (0);
}

int func2(char *something, ...){
 va_list v1;
 va_start(something, v1);
 //... do something with the data...

 va_end(v1);

 return (0);
}
  
obviously the above doesn''t work. I''ve also tried...
  
int func1(char *something, ...){
 func2(something);
 return (0);
}

int func2(char *something, ...){
 va_list v1;
 va_start(something, v1);
 //... do something with the data...

 va_end(v1);

 return (0);
}
  
Any ideas? thanx. ... LEMMINGS ... LEMMINGS ... LEMMINGS ... LEM..... SpLaSh!... Is it what we look like on the eyes of destiny or God? Are we LeMmIngS or WhAt!?
... LEMMINGS ... LEMMINGS ... LEMMINGS ... LEM..... SpLaSh!...Could this be what we stand like before the mighty One?Are we LeMmIngS or WhAt!? ;)
void __cdecl VSFunction (int iVal, va_list pLST)
{
// Access pLST as an array.
}

void __cdecl Function (int iVal, ...)
{
va_list lstParams;
va_start (iVal, lstParams);
VSFunction (iVal, lstParams);
}

Also see "vsprintf".
VK
Advertisement
can''t u just pass the string? try passing the char*

life is unfair, take advantage of it.
UNMB2 - if the link doesn''t work, try clicking it
life is unfair, take advantage of it.UNMB2 - if the link doesn't work, try clicking it :)

This topic is closed to new replies.

Advertisement