函数功能:把格式化的数据写入某个字符串函数原型: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"
时间: 2025-01-13 10:45:31