C语言从文件中读取数据的问题

来源:百度知道 编辑:UC知道 时间:2024/09/22 14:25:31
写一个c语言程序,其中必须包含下列代码:
float a,b;
int i,j;
char c1,c2,c3;
int Retcode;
Retcode=fscanf(stdin,"%o 2%ld %c 5%c %c %f %f",
&i,&j,&c1,&c2,&c3,&b,&a);
要从一个文件,Text2.in中读取数据
Text2.in的内容如下:
***77**243567\n
*2.4e3**14.7\n
172**\n
其中*号是空格,
要求得到i,j,c1,c2,c3,b,a,Retcode这几个变量的值?
我写的代码是:

This is a part of a program:
float a,b;
int i,j;
char c1,c2,c3;
int RetCode;
RetCode=fscanf(stdin," %o 2%ld %c 5%c %c %f %f ",&i,&j,&c1,&c2,&c3,&b,&a);

i need use this program to read some information from a file which named "Text2.in",
i am going to show you what's in the file "Text2.in"
***77**243567\n
*2.4e3 14.7\n
172**\n

i used * replace blank,in reality they are blanks

and the question is what's the value of Retcode,a,b,i,j,c1,c2,c3????

now i am going to show you my program

参考代码如下: 
#include <stdio.h>
#include <iostream.h>
void main()
{
 FILE* EMFile = fopen("D://EMFile.TXT","r");
 if (!EMFile) {
  cout<<"FILE NOT FOUND!";
  return;
 }
 int XN=2;//假设文件有两行,三列
 int YN=3;
 float** Ef;
 Ef = new float*[XN];
 for(int idx=0;idx<XN;idx++)
 {
  Ef[idx] = new float [YN];
 }
 for(int i=0;i<XN;i++)
 {
  for(int j=0;j<YN;j++)
   Ef[i][j] = 0.0 ;
 }
 for(int xn=0;xn<XN;xn++)
 {
  for(int yn=0;yn<YN;yn++)
  {
   fscanf(EMFile,"%f",&