Chris Weimann wrote:
> I have written a function called OutStr, which is a scaled-down version 
> of printf  for a small embedded system:
> 
> void OutStr(const char * format, ...);
> 
> Now I want to write another function that uses this function to write to 
> various output devices, like this:
> 
> void OutStrDevice(int Device, const char  * format, ...);
> 
> How can I call OutStr from within OutstrDevice and pass the same 
> parameters in ellipsis?
> 
> This illustrates what I am trying to do:
> 
> void OutStrDevice(unsigned int Device, const char  * format, ...)
> {
>   switch(Device)
>   {
>     case 1:
> // code enable device1 one here
>   break;
>   default:
>     case 2:
> // code enable device2 one here
>   break;
>   }
>   Outstr(format,?????);   // <-- How do I do this?
> }
> 
> 
> Regards
> 
> Chris

You can't (at least not in a Standard way).  Grab the varargs and just 
pass that.  Take a look at any printf() implementation.  printf() is 
typically not the function you end up ultimately calling.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to