C++ sprintf_s 字符串拼接
2017-02-07 10:18
337 查看
定义一个buf 格式如下:
char buf[128] = {0};
例子:
sprintf_s(buf,128,"%s%d",appGetGlobal()->getText("id"),appGetGlobal()->getVersion());
m_versionLabel = CCLabelTTF::create(buf,"Arial",20,CCSizeMake(200,25),kCCTextAlignmentLeft,kCCVerticalTextAlignmentCenter);
m_versionLabel->setAnchorPoint(ccp(0,0.5));
m_versionLabel->setPosition(ccp(124,38));
this->addChild(m_versionLabel);
char buf[128] = {0};
例子:
sprintf_s(buf,128,"%s%d",appGetGlobal()->getText("id"),appGetGlobal()->getVersion());
m_versionLabel = CCLabelTTF::create(buf,"Arial",20,CCSizeMake(200,25),kCCTextAlignmentLeft,kCCVerticalTextAlignmentCenter);
m_versionLabel->setAnchorPoint(ccp(0,0.5));
m_versionLabel->setPosition(ccp(124,38));
this->addChild(m_versionLabel);
相关文章推荐
- c++拼接字符串效率比较(+=、append、stringstream、sprintf)
- c++拼接字符串效率比较(+=、append、stringstream、sprintf)
- c++拼接字符串效率比较(+=、append、stringstream、sprintf)
- c++拼接字符串效率比较(+=、append、stringstream、sprintf)
- 【转载,实用】c++拼接字符串效率比较(+=、append、stringstream、sprintf)
- c++拼接字符串效率比较(+=、append、stringstream、sprintf)
- C/C++将一个整型数组拼接成一个字符串
- 【C++】sprintf的用法详解 (打印成各种格式的字符串)
- C++字符串格式化 sprintf、printf
- c++的字符串char与string相互转化,以及string的,切割,替换字符,字符串拼接方法(object向c++转型系列教程2)
- C++中拼接一个包含整型等类型字符串的方法
- [转]C++ 字符串格式化 sprintf
- C++——字符串的拼接
- 初学c/c++——深入字符串(sprintf与sscanf)
- [转]C++字符串格式化 sprintf
- c++字符串拷贝几个方法浅析sprintf,strcpy及memcpy
- C++ 小技巧之 字符串字面值拼接
- C++字符串格式化 sprintf详解
- C++字符串格式化 sprintf
- C++字符串格式化 sprintf