I need to be able to pass parameters to printf from another function. What I have so far works for some data types, but not character buffers, aka strings. Here is what I have that does not work. The SetDirection() are for setting the data direction of external hardware.
int xprintf (char *fmt, ...) { int rv; register int *varg = (int *)(&fmt); SetDirection(1); rv = printf(fmt, varg); SetDirection(0); return rv; }
Did you try to use the va_*() macros? There is an example in the tool's user guide how use to a function with a variable-length argument list. Search for va_start().
"Search for va_start()."
A better example in the context of what the OP is trying to do is:
http://www.keil.com/support/man/docs/c51/c51_vprintf.htm