sscanf可以理解为string+scanf;sprintf可以理解为string+printf。
(均在stdio.h头文件下)
假设定义了一个char数组str[100],可写为
sscanf(str,"%d",&n);
sprintf(str,"%d\n",n);
当然,它的应用格式不止一种,还有一种为
sscanf(str,"%d:%1f,%s",&n,&db,str2);
ssprintf(str,"%d:%2f,%s",n,db,str2);
要记住的是,sscanf与spintf一般不同时存在
sscanf与sprintf
最新推荐文章于 2020-07-02 17:35:34 发布