第十四讲文件和函数.pdfVIP

  • 0
  • 0
  • 约1.02万字
  • 约 46页
  • 2018-04-29 发布于河南
  • 举报
第十四讲文件和函数

POJ 1013 2 stdio.h FILE FILE *fopen(const char *filename, const char *mode); mode – r w a + b t int fclose(FILE *fp); int fprintf(FILE *fp,const char *format,…); int fscanf(FILE *fp,const char *format,…); 3 #include stdio.h void main() { int x, y; FILE *fp1, *fp2; fp1 = fopen(student.txt,r); fp2 = fopen(student2.txt,w); if(fp1==NULL || fp2==NULL) return; // while(fscanf(fp1, %d, x)0) { // fscanf0 y=x; fprintf(fp2, %d\n, y); } fclose(fp1); fclose(fp2); } 4 5 ( , … ) …… 6 7 declaration “” “”call definition 8

文档评论(0)

1亿VIP精品文档

相关文档