实验4
#include<stdlib.h> #include<stdio.h> int main () { FILE *fp; char ch; int count=0; fp=fopen("data4.text","r"); if(fp==NULL) { printf("无法打开文件"); return 0; } while ((ch=fgetc(fp))!=EOF) { if(ch!=' '&&ch!='\n'&&ch!='\t') { count++; } }fclose(fp); printf("文件中字符数(不包括空白符):%d\n",count); return 0; }
标签:fp,count,ch,int,实验,printf,include From: https://www.cnblogs.com/2423416197zmq/p/17467153.html