stdafx.cpp
来自「一个卫通GPS系统SUC接口示例。该示例演示如何实现客户端如何与卫通GPS系统连」· C++ 代码 · 共 87 行
CPP
87 行
// stdafx.cpp : source file that includes just the standard includes
// MTTest.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
//提取XML中的指定标签的内容
int getXMLTagValue(CString &strXML, CString strTag, CString &strValue)
{
CString strFind1, strFind2;
int nPos1, nPos2;
strFind1 = "<" + strTag + ">";
if((nPos1=strXML.Find(strFind1)) == -1)
{
strFind1 = "<" + strTag + " ";
if((nPos1=strXML.Find(strFind1)) == -1)
{
return -1;
}
else
{
nPos1 = strXML.Find(">", nPos1);
if(nPos1 == -1)
{
return -1;
}
else
{
nPos1 += 1;
}
}
}
else
{
nPos1 += strFind1.GetLength();
}
strFind2 = "</" + strTag + ">";
nPos2 = strXML.Find(strFind2, nPos1);
if(nPos2 == -1)
{
return -1;
}
strValue = strXML.Mid(nPos1, nPos2-nPos1);
return nPos2;
}
//提取XML中的指定标签的指定属性的值
int getXMLTagPropValue(CString &strXML, CString strTag, CString strProperty,CString &strValue)
{
CString strFind1;
int nPos1, nPos2;
strFind1 = "<" + strTag + " ";
if((nPos1=strXML.Find(strFind1)) == -1)
{
return -1;
}
nPos2 = strXML.Find(">", nPos1);
if(nPos1 == -1)
{
return -1;
}
CString str;
str = strXML.Mid(nPos1, nPos2-nPos1);
nPos1 = str.Find(strProperty);
nPos1 += strProperty.GetLength()+2;
nPos2 = str.Find("\"", nPos1);
strValue = str.Mid(nPos1, nPos2-nPos1);
return nPos2;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?