void CGPS_receiverDlg::OnStart()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);//update m_format
m_filesize = 0;//reset log info
m_timespan = "00:00";
UpdateData(FALSE);
switch (m_format) {
case 0://NMEA/GGA
m_com.GetInput();//清空接收缓冲区
m_com.SetRThreshold(84);
m_com.SetInputLen(84);//一条GGA语句约为84字节
m_com.SetOutput(COleVariant("em,/dev/ser/a,nmea/GGA:0.1\n"));
break;
case 1://JPS/{RT,PO}
m_com.GetInput();//清空接收缓冲区
m_com.SetRThreshold(47);//一条RT + 一条PO语句 = 47字节
m_com.SetInputLen(47);
m_com.SetOutput(COleVariant("em,/dev/ser/a,jps/{RT,PO}:0.1\n"));
break;
}
m_startTime = CTime::GetCurrentTime();
m_start.ShowWindow(SW_HIDE);
m_stop.ShowWindow(SW_SHOW);
//将串口读入的数据存储至.in文件,将处理过的数据存储至.out文件
CString c;
switch (m_format) {
case 0: c = "E:\\NMEA"; break;
case 1: c = "E:\\JPS"; break;
}
CTime t = CTime::GetCurrentTime();
c += t.Format("%m%d_%H%M.in");
m_inFile.Open((LPCTSTR)c, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
m_inFile.Flush();
c.Replace(".in", ".out");
m_outFile.Open((LPCTSTR)c, CFile::modeCreate | CFile::modeWrite);
m_outFile.Flush();
}void CGPS_receiverDlg::OnStop()
{
// TODO: Add your control notification handler code here
m_com.SetOutput(COleVariant("dm,/dev/ser/a\n"));
m_start.ShowWindow(SW_SHOW);
m_stop.ShowWindow(SW_HIDE);
m_inFile.Close();
m_outFile.Close();
}代码如上,现在的问题是创建了IN,OUT文件,但是数据写不进去,所以也无法调出.然后运行到stop函数的Close语句就会出问题.
请问问题出在哪? 怎么解决啊?