占位符解析@#
来源:互联网 发布:淘宝网总裁张杰 编辑:程序博客网 时间:2024/06/03 16:40
啊,简直要笨死了!!!!<img alt="大哭" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/wail.gif" /><img alt="敲打" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/knock.gif" />
// XML解析.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>#include <string.h>#include <stdlib.h>#include <stddef.h>using namespace std;/**************************************************************************char *szPacket = "@szCamCode#@szDirect#@szTime#";int main (){<span style="white-space:pre"></span>char *pcTemp;<span style="white-space:pre"></span>pcTemp = new char(128);<span style="white-space:pre"></span>memset (pcTemp,0,128);<span style="white-space:pre"></span>strcpy(pcTemp,szPacket);<span style="white-space:pre"></span>cout<<"the pcTemp is :"<<pcTemp<<endl;<span style="white-space:pre"></span>strcpy(pcTemp,"hello"); cout<<"the pcTemp is :"<<pcTemp<<endl; //可以直接覆盖 <span style="white-space:pre"></span>getchar();<span style="white-space:pre"></span>return 0;}******************************************************************************/char *szPacket = "@szCamCode#@szDirect#@szTime#.xml";int main (){<span style="white-space:pre"></span>char *pcTemp =szPacket;<span style="white-space:pre"></span>//只是单纯的指针<span style="white-space:pre"></span>char *pcTemp1=NULL;<span style="white-space:pre"></span>char *pcTemp2=NULL;<span style="white-space:pre"></span>//保存数据 <span style="white-space:pre"></span>char *ptr=new char[30]; // new char (30 ) ; error do { pcTemp1=strchr(pcTemp,'@'); cout<<"pcTemp1 is :"<<pcTemp1<<endl; pcTemp2=strchr(pcTemp,'#'); cout<<"pcTemp2 is :"<<pcTemp2<<endl; int len =strlen(pcTemp1)-strlen(pcTemp2); cout<<"len is:"<<len<<endl; strncpy(ptr,pcTemp1+1,len-1); *(ptr+len-1)='\0'; cout<<"ptr is :"<<ptr<<endl;<span style="white-space:pre"></span> pcTemp=pcTemp2+1;<span style="white-space:pre"></span>}while (*(pcTemp2+1)!='.');<span style="white-space:pre"></span>system("pause");<span style="white-space:pre"></span>return 0;}
0 0
- 占位符解析@#
- spring占位符解析器---PropertyPlaceholderHelper
- spring占位符解析器---PropertyPlaceholderHelper
- Spring自定义占位符替换(PropertyPlaceholderConfigurer解析)
- spring文件无法解析占位符,按照字符串解析
- spring源码解析(一)---占位符解析替换
- spring源码解析(一)---占位符解析替换
- Spring 占位符解析器的作用 - PropertyPlaceholderHelper
- Hibernate-Validator 5.1.0.Final 无法解析自定义占位符
- docx4j 解析docx时 出现占位符分开的情况
- spring+mybatis 配置文件占位符不能解析的问题
- .properties文件读取及占位符${...}替换源码解析
- 使用Freemarker解析占位符,构造可执行的SQL语句
- 占位符
- 占位符
- 占位符
- 占位符
- 占位符
- Android中关于Volley的使用(五)从RequestQueue开始来深入认识Volley
- Linux-Ubuntu14.04下配置ftp,安装java1.8和tomcat8
- 14章 解答4 根据指定不同字符,生成不同三角形
- 设计与声明(二)
- codeforces373#A
- 占位符解析@#
- Java 变量初始化总结
- QList<T> 的释放分两种情况
- Python(x,y)安装
- 【Spring】Spring之我见
- codeforces373B#
- BZOJ 2502 清理雪道
- p3110 二叉堆练习3--排序
- getline函数