.txt 文件为 91 4 153 0.937116 91 4 152 0.921534 92 4 152 0.739534 并且光标在最后一行数据的下一行的开头 while (! feof(fp)) { fscanf(fp, "%d %d %d %lf", &x, &y, &z, &daten); printf("%d \t%d \t%d \t%f\n",x, y, z, &daten); fclose(fp); 提取后屏幕显示为 91 4 153 0.937116 91 4 152 0.921534 92 4 152 0.739534 92 4 152 0.739534 请问如何解决此问题 我试用除去最后一行,显示...
fgets(mybuf,32,str_in); fscanf(str_in,"[^0-9]%",&p1) ; printf("%d\n",p1); mybuf=" thisistest!!!= 4282" 但是死活都只输出1073939944,不晓得为什么,郁闷死了
data = (double **) malloc(row*sizeof(double *));
assert(data);
for (int i=0; i
#include
学号 成绩 0401 70 0402 69 0403 0404 78 ................. 我在用 while( ) { fscanf( fp,"%f" , &num); fscanf( fp,"%f" , &score); ....... } 对于0403缺考,成绩在文件中是空的, score于是就读成了0404了; 那为能指点我, 让指针 每次从文件的每行的开头 开始读取数据!
我写了一段代码,但运行起来,打印输出的结果总不对,请指教! int Numberin,Numberout; Numberin = 1236; ... fprintf(file, "%i\n", Numberin);//write the file ... fscanf(file, "%i\n",&Numberout);//read the parameter Numberin printf("%i\n",Numberout);//output 但是输出的数字不等于1236, 不知道错在哪里了?
我现在要从一个文件中取数据,以下是文件中的部分数据 len-a 64 value-a EA227D27, len-p 32 611DB8F5 就是这样的格式,我每次读一行,就是这样用的, fscanf(fp2,"%s",str); 现在的问题是,他每次读数据,读完EA227D27 后,就不换行了,一直取这个数据,不知道哪里用错了, 请各位指导 谢谢
[code] fscanf( fp, "%100[^\n#]s", s ); fscanf( fp, "%*[^\n]s" ); [/code] 为什么 "%100[^\n#]s" 要那个s呢?
刚才一哥们问我一简单问题,却被问住了,问题缩减为如下代码。
在VC6.0中编译,运行出现错误,在读入x,y,x时出现运行时错误(死活想不明白为什么),如果把下面的注释行去掉,OK,又行了,很晕
编译器Bug?还是?
[code]
#include