Home > Back-end >  C elements are read from the file
C elements are read from the file

Time:10-11

I want to read from the file element, element there are both int and char, then the output element
Such as the elements in the file is 2, 3, 5 * 10 +/- 2
I'd like to file the elements in the read output again after them, but I don't know what was wrong with this code
Ifstream in;
In the open (" E:/c.t xt ");
int a;
Char b;
while(! In the eof ())
{the while (in> A)
Cout b;
Cout}
Please everyone a great god give directions, best can point out errors, and write the correct code, very grateful!

CodePudding user response:

 in the open (" E: \ \ c.t xt "); 

CodePudding user response:

The end of this post - _ - 2 l

CodePudding user response:

reference 1st floor sololie response:
. In the open (" E: \ \ c.t xt "); 

Not ah, the output is 2, 3, 5 * 1 0 2//
File to read the part no problem, mainly is the output not ah

CodePudding user response:

 void CSavedataDlg: : OnBtnSavedata () 
{
//TODO: Add your the control notification handler code here
//used to preserving image data area in TXT file
The UpdateData (TRUE);
Ofstream FileSave (" SystemData. TXT ");
if(! FileSave) return;
FileSave & lt; FileSave & lt; FileSave & lt; FileSave & lt; FileSave & lt; FileSave & lt; FileSave & lt;
FileSave & lt; FileSave. Close ();
The UpdateData (TRUE);
}

Void CSavedataDlg: : InitData ()
{
The UpdateData (TRUE);
The FILE * FileRead;
If ((FileRead=fopen (" SystemData. TXT ", "r"))==NULL)
{
Printf (" cant not open the file ");
return;
}
Fscanf (FileRead, "% d % d % d % d % d % d % s", & amp; M_1, & amp; M_2, & amp; M_3, & amp; M_4, & amp; M_5, & amp; M_6 m_str);
The UpdateData (FALSE);
}

CodePudding user response:

This is the problem of your code, it is recommended that the modified code
  • Related