Home > Software engineering >  Cfile problem in MFC
Cfile problem in MFC

Time:10-27

A Cfile object in MFC program reads the data from sensors and then write to TXT file, when transplanted into another program is to create a TXT file, sensor data read, TXT files are 0 KB

CodePudding user response:

Is there any FileClose

CodePudding user response:

See whether you read correctly to the first data, a print, and then written to the file if there is a mistake

CodePudding user response:

 LRESULT CPowerweightDlg: : OnUpdateEditMsg (WPARAM WPARAM, LPARAM LPARAM) 
{
Cstrings angleData1, newLine="\ r \ n";
AngleDataFile1. SeekToEnd ();//file pointer to the end-of-file
AngleData1. The Format (" % f ", m_load_pv);
AngleDataFile1. Write (angleData1, 6);//write
AngleDataFile1. Write (newLine, 2);//line breaks

The UpdateData (FALSE);
return 0;
}

CodePudding user response:

Thank you, no problem on this code in a program, to simply create the TXT file on another program, TXT files are 0 KB

CodePudding user response:

A program only read the tension sensor data that can, another program was originally read a grating ruler of the serial port data, then I read it with tension sensor code and create a file of the program, the data can be displayed on the ntgraph graphics controls, but cannot write on the TXT file

CodePudding user response:

reference 1st floor boylafong response:
have FileClose

To ask,

CodePudding user response:

reference 4 floor wfy1235811 response:
thank you, no problem on this code in a program, to simply create the TXT file on another program, TXT file is always 0 KB

You look under the Debug debugging, your data is correct? There is no problem ~ to ensure that your data
  • Related