what exactly does the sprintf() function?? I use it in my game and works fine, but i dont really know how it works.
what exactly does the sprintf() function?? I use it in my game and works fine, but i dont really know how it works.
---Programming is like roaming, you never know where you'll end at------
If 'here' is pronounced as 'hear', why 'there' isnt pronounced as 'dear'??
[email protected]
doesnt it combine things to make 1 variable?
like:
int a = 100;
char buffer[256];
buffer = sprintf("This is a number: %n", a);
"There are three kinds of people in the world...
Those that can count and those that can't."
It takes a similiar input as printf, but instead of writing it to the screen it writes it to a string.
sprintf can write past the end of the string (in this case it is 256). In order to avoid that you can use snprintf.Code:char Buffer[256]; sprintf(Buffer, "This is a string: %s\tInteger: %d\tFloat: %f", String, Int, Float);
- SeanCode:char Buffer[256] snprintf(Buffer, 256, "This is a string: %s\tInteger: %d\tFloat: %f", String, Int, Float);
If cities were built like software is built, the first woodpecker to come along would level civilization.
Black Frog Studios