sprintf()函数的用法

时间:2022-01-20 14:59:58

sprintf(g_strAppName, "%s",pLast+1);

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

sprintf()函数的用法

函数功能:把格式化的数据写入某个字符串
函数原型: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"