format output for char *

I want to format some text from different variables to use as an argument for a function that is expecting char * as an input. I am drawing a blank. I have tried casting and different printf combinations, but I am not arriving at a solution.

As an example:
I have Hour and Minutes which are bytes, and Seconds which is a float, and I want to put it together as an input to a char *

But this doesn't work:

someFunction(0,0,printf("%i:%i:%2.3",H,M,S));

The error I am getting is:
invalid conversion from int to char*. I have determined it's not a datatype in the printf, but rather the "result" of printf?

As I said, I have tried casting it "(char *)" in front of "printf" which compiled, but doesn't give the expected result. I know I'm missing the obvious, I just can't see it

Any help would be appreciated, thanks

printf returns a count, not an array of chars.

look at sprintf to format to your own buffer ( char[] ) that you can then pass to the function.

http://www.cplusplus.com/reference/cstdio/sprintf/

No float support in AVR Arduinos though ( sprintf ), look at recent posts, this was discussed yesterday I think.

sprintf, that was my brain fart for the day, thanks. I'll go looking for those posts now. Thanks again

printf("%i:%i:%2.3",H,M,S)

That isn't a valid format string anyway, where is the letter code for the third parameter S ?

It should be %i:%i:%2.3f except 2.3 isn't valid ( it should be something more like %6.3f ), and f won't work on Arduino.

It's in <stdio.h> which I guess is default included.

Here's the stdio reference page.
http://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html#ga6017094d9fd800fa02600d35399f2a2a