标题:数据文件读取
只看楼主
fnj1023
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-1-11
结帖率:0
 问题点数:0 回复次数:0 
数据文件读取
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#define  FILE_PATH   "test.txt"
#define  MAX_LINE   100
#define  N   5
void main()
{float U0[N];

FILE* fileName ;
 
 fileName = fopen(FILE_PATH, "rb");
 if(fileName == NULL)
 {
  printf("无法打开指定的文件, 请确定文件是否存在\n");
  return;
 }
  fread(U0, sizeof(float), N, fileName);
  printf("文件中的数据是: \n");
  for(int i=0; i<N; i++)
 {
     printf("%f\n", U0[i]);
 }
}
为什么读出的数都是0呢??各位高手谁能帮我看看~~
搜索更多相关主题的帖子: include return 
2012-02-18 16:23



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-361132-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 2.338085 second(s), 10 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved