您的位置:首页 > 其它

fprintf函数将格式打印到文件,非常好用(怎么没早点发现这个函数)

2017-04-03 04:51 302 查看
/* fprintf example */
#include <stdio.h>

int main ()
{
FILE * pFile;
int n;
char name [100];

pFile = fopen ("myfile.txt","w");
for (n=0 ; n<3 ; n++)
{
puts ("please, enter a name: ");
gets (name);
fprintf (pFile, "Name %d [%-10.10s]\n",n+1,name);
}
fclose (pFile);

return 0;
}


打印所有字符的GBK编码:
http://www.cnblogs.com/findumars/p/5557239.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: