VS2010 文件打开出错
#include<stdio.h>#include<stdlib.h>#include<windows.h>voidmain(){FILE*fp;//建文件指针//int...
#include<stdio.h>#include<stdlib.h>#include <windows.h>void main(){ FILE*fp; //建文件指针// int i=0,j; fp=fopen("1.txt","r"); if((fp=fopen("1.txt","r"))==NULL) //判断文件是否存在// { fprintf(stderr,"Error opening file excel.txt\n"); //*stdeer-标准错误输出设备,文件不存在则关闭,提示错误*// system("pause"); } printf("date:\n"); while(!feof(fp)) { fscanf(fp,"%d",&j); printf("%5d",j); //小数点后面五位// i++; if(i==21); //换行// printf("\n"); } printf("There are %d numbers\n",i); // 输出了多少个数// fclose(fp);}
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询