|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
求大神帮忙看下如何实现遍历所有编辑框的中数据,实现循环解析GPS的数据!以下代码仅能实现一行数据的解析!
数据源:
$GPRMC,014254.70,A,2603.613111,N,11910.693806,E,0.364,273.16,230719,,,A*69
$GPGGA,014254.70,2603.613111,N,11910.693806,E,1,12,1.13,4.50,M,9.90,M,,*64
$GPRMC,014254.80,A,2603.613113,N,11910.693794,E,0.370,272.77,230719,,,A*63
$GPGGA,014254.80,2603.613113,N,11910.693794,E,1,12,1.13,4.50,M,9.90,M,,*6D
$GPRMC,014254.90,A,2603.613115,N,11910.693792,E,0.368,271.60,230719,,,A*6E
$GPGGA,014254.90,2603.613115,N,11910.693792,E,1,12,1.13,4.60,M,9.90,M,,*6F
$GPRMC,014255.00,A,2603.613123,N,11910.693764,E,0.365,273.78,230719,,,A*6C
$GPGGA,014255.00,2603.613123,N,11910.693764,E,1,12,1.13,4.60,M,9.90,M,,*6B
//GPS数据解析
split split;//切分函数类
CString buffString;
int nlinecout1 = (m_EditRev.GetLineCount() - 1);//获取行数
for (int i = 0; i < nlinecout1; i++)
{
int len = m_EditRev.LineLength(m_EditRev.LineIndex(i));
buffString = m_strReceive;//编辑框值变量,原始数据保存在该变量
split.SetSplitFlag(_T(","));//切分标志
split.SetSequenceAsOne(TRUE);
split.SetData(buffString);
CStringArray array;
split.GetSplitStrArray(array);//将切分的数据存入数组中
//判断读取的GPS信息的类型
if (array[0] = "$GPRMC")
{
m_strJD = array[3].Left(2) + "." + array[3].Mid(2, 2) + array[3].Right(6) ;
m_strWD = array[5].Left(3) + "." + array[5].Mid(3, 2) + array[5].Right(6) ;
}
UpdateData(false);
}
之前尝试用GetLine()循坏获取EDIT控件中的每一行的内容,但是每一行的正确数据后面总带有乱码!
请大神在代码上指点一下! |
|