C语言 数据文件的读取
C语言读取文件读出来的都是字符型的吗,我现在txt文件中存的是采集卡采到的一些数据,现在要通过读文件将这些数据存入数组中再进行数据处理,需要如何进行数据读取呢,希望可以有哪位高手帮帮忙,最好有程序~~不胜感激~~
程序代码:#include<stdio.h>
#include<stdlib.h>
void load(char* c)
{
int i;
FILE *fp;
if((fp=fopen("123.txt","rt"))==NULL)
{
printf("sorry,can not open!!\n");
exit(0);
}
for(i=0;i<25;i++)
{
fread(&c[i],25,1,fp);
}
fclose(fp);
}
void main()
{
char c[25]="\0";
load(c);
puts(c);
}