⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stdafx.cpp

📁 一个卫通GPS系统SUC接口示例。该示例演示如何实现客户端如何与卫通GPS系统连接实现车载终端点名等功能
💻 CPP
字号:
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -