函数功能:把格式化的数据写入某个字符串
函数原型:int sprintf( char *buffer, const char *format [, argument] … );
返回值:字符串长度(strlen)
例子:
char* who = "I"; char* whom = "CSDN"; sprintf(s, "%s love %s.", who, whom); //产生:"I love CSDN. " 这字符串写到s中 sprintf(s, "%10.3f", 3.1415626); //产生:" 3.142" /*NOTE:这样就不会报错了*/ u8 text[20]; sprintf((char *)text, "-Value:%d", Value);