char转换为double;int转换为char

char转换为double
char* chaValue = "116.397380;39.908395";
double x = 0.0;
 double y = 0.0;
 sscanf(chaValue, "%lf;%lf", &x, &y);

int转换为char
int m_btCommPort = 1;
 int m_dwBaudrate = 4800;
CString strCommPort;
 strCommPort.Format("%d", m_btCommPort);
 CString strBaudrate;
 strBaudrate.Format("%d", m_dwBaudrate);
 CString chaValueString = strCommPort + ";" + strBaudrate;
 int length = chaValueString.GetLength();
 char* chaValue = new char[length];
 chaValue = chaValueString.GetBuffer(length);  

你可能感兴趣的:(char转换为double;int转换为char)