<stdio.h>
原型:
int sprintf(char *str, const char *format, …)
发送格式化输出到 str 所指向的字符串。
参数
str – 这是指向一个字符数组的指针,该数组存储了 C 字符串。
format – 这是字符串,包含了要被写入到字符串 str 的文本。它可以包含嵌入的 format 标签,format 标签可被随后的附加参数中指定的值替换,并按需求进行格式化。format 标签属性是 %[flags][width][.precision][length]specifier
对比一下 printf() 的原型: int printf(const char *format, …)
The first argument to sprintf() is the address of the target string. The remaining arguments are the same as for printf() — a conversion specification string followed by a list of items to be written.