This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Passing parameters to printf()

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;
}

Parents
  • I am trying to pass a list of variables to a function. Not sure how to pars out the information. In the above case using printf, the format is passed correctly, integer values are passed correctly, but string values are not, returning unpredictable results.

Reply
  • I am trying to pass a list of variables to a function. Not sure how to pars out the information. In the above case using printf, the format is passed correctly, integer values are passed correctly, but string values are not, returning unpredictable results.

Children