O answer!!!!! 0 xc0000094, serial port communication problem!!!
Time:09-21
Recently took over others write a software, running environment is XP, peripherals is a temperature measuring instrument, the program contains the function of serial communication, with a serial port, normal communication, software running every time after 13 hours or so, I snapped, prompt application exception occurs, the unknown software error 0 xc0000094!!!!!! When I unplug a serial port, the software running all day no problem, so I judge is a serial port communication of this code, not much said, first stick source: //a serial port communication LONG CMainFrame: : OnCommunication (WPARAM ch, LPARAM port) { Int j;
//serial port 1, connect the temperature meter for (j=0; J<4. J++) { If (port==m_nPorts [j] & amp; & M_tyPorts [j]=={PORT_TYPE_TEMP) If (ch==10)//get the return code, says up { Cstrings STR, TSTR;
STR=m_strPortReceived [j]; M_strPortReceived [j]=""; STR. SetAt (STR) GetLength () - 1, '\ 0'); STR. TrimLeft (); STR. TrimRight ();
If (STR. Mid (0, 2)=="!//T ")? The temperature of the monochromatic W get? T get double color temperature { STR=STR. Mid (2);
int i;//I is used to store to get temperature, usually for a few red, temperature or letters, such as EUUU I=StrToInt (STR);
//only after sending the query command in processing the received data If (m_nTempQuery [j] & gt; 0 { M_nTempDetail [j] [m_nTempDetailCount [j] - 1]=I;
//remove the temperature of less than 10 If (I & lt; M_temp_expt_low) return 0;
//get the maximum If (i> [j]) (int) m_fTempVal m_fTempVal [j]=(float) I; } } } The else { M_strPortReceived [j] +=(char) ch;
}
break; } }
Doubted memory leaks, but observe a resource manager in memory usage, memory has been a steady and rarely, 2. The program to send a serial port every second request to measure temperature of command? T (the temperature gauge defined request instructions, followed by a carriage return said sent), is back! TEUUU or! T1234 (1234 of them said temperature, behind also has a carriage return, table after receiving),
Sincerely for the great god, can you see suspicious, please help!!!!!!
CodePudding user response:
0 xc0000094l STATUS_INTEGER_DIVIDE_BY_ZERO integer division by 0 The DEBUG mode, open the Win32 in anomaly, DEBUG mode, it is easy to capture the exception, melt when combined with debugging stack modification solution