#include <stdio.h>
#define ARRAY_SIZE 65535
int main()
{
char a[ARRAY_SIZE];
int c;
FILE *fp;
int n, i;
fp = fopen("data.txt", "r");
if(!fp) return 1;//读文件失败,退出
n = 0;
while((c = fgetc(fp))!=EOF){
if(n >= sizeof(a)) break; //超过数组大小,跳出
if(c == ' ') continue; //不要空格
if(c == '\r') continue;//不要回车
if(c == '\n') continue;//不要换行符
printf("%c", c);//输出读入的数据
a[n] = c;
n++;
}
fclose(fp);//关闭文件
return 0;
}
温馨提示:答案为网友推荐,仅供参考