Does a function like this currently exist?
i'm wondering if a function exists that basically appends a string in a formatted style. example:
Code:
int x = 50;
int y = 100;
char *blah = "that's great!";
char *text;
text = "Whee, you have ";
//and here's where the function would be...
//i'm making up a name for it ;)
buffer_printf (text,"%i apples and %i bananas! %s",x,y,blah);
output being, "Whee, you have 50 apples and 100 bananas! that's great!"
Re: Does a function like this currently exist?
Quote:
Originally posted by IonBlade
Code:
int x = 50;
int y = 100;
char *blah = "that's great!";
char *text;
text = "Whee, you have ";
//and here's where the function would be...
//i'm making up a name for it ;)
buffer_printf (text,"%i apples and %i bananas! %s",x,y,blah);
output being, "Whee, you have 50 apples and 100 bananas! that's great!"
And then there's C++ output:
Code:
cout << text << x << " apples and " << y << " bananas! " << blah;
If you have to do this repeatedly, you can write your own function that accepts some numbers and strings and outputs them in the correct order.