/* 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+1,name); } fclose (pFile); return 0; }
打印所有字符的GBK编码:
http://www.cnblogs.com/findumars/p/5557239.html