7.980968803167D-06-7.958078640513D-13 0.000000000000D+00-1.922528497212D+00
1.510000000000D+02-7.706250000000D+01 4.236247796996D-09-1.922528497212D+00
-4.094094038010D-06 1.224376657046D-02 9.084120392799D-06 5.153689567566D+03
1.800000000000D+05 1.601874828339D-07 5.144823948283D-03-1.341104507446D-07
9.616900133578D-01 2.031875000000D+02-2.213358636049D+00-7.747465780028D-09
-2.703683943395D-10 1.000000000000D+00 1.413000000000D+03 0.000000000000D+00
2.800000000000D+00 0.000000000000D+00-1.024454832077D-08 4.070000000000D+02
1.800000000000D+05
怎么把每一个数据读出来,一行四个数据,还有正负号。每一行前有三个空格,我遇到的问题主要是前面的空格问题。
下面是我的程序,每次开始读第二行开始就有问题。
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
main()
{
FILE *fn;
char ch[50][21];
int i;
char b[5];
if((fn=fopen("1.txt","r")) ==NULL)
{
printf("cannot open YJS206.07n.\n");
exit(-1);
}
fgets(b,4,fn);
fgets(ch[0],20,fn);
printf("%s",ch[0]);
for(i=1;i<30;i++)
{
if(i%4==0)
{
fgets(b,4,fn);
}
fgets(ch[i],20,fn);
printf("%s ",ch[i]);
}
getch();
}