C++字符串格式化(FormatString)
来源:互联网 发布:怎么看自己淘宝联盟pid 编辑:程序博客网 时间:2024/05/19 23:03
string FormatString(const char *lpcszFormat,...){char *pszStr = NULL;if (NULL != lpcszFormat){va_list marker = NULL;va_start(marker, lpcszFormat); //初始化变量参数size_t nLength = _vscprintf(lpcszFormat, marker) + 1; //获取格式化字符串长度pszStr = new char[nLength];memset(pszStr, '\0', nLength);_vsnprintf_s(pszStr, nLength, nLength, lpcszFormat, marker);va_end(marker); //重置变量参数}string strResult(pszStr);delete[]pszStr;return strResult;}wstring FormatWstring(const wchar_t *lpcwszFormat,...){wchar_t *pszStr = NULL;if (NULL != lpcwszFormat){va_list marker = NULL;va_start(marker, lpcwszFormat); //初始化变量参数size_t nLength = _vscwprintf(lpcwszFormat, marker) + 1; //获取格式化字符串长度pszStr = new wchar_t[nLength];memset(pszStr, L'\0', nLength);_vsnwprintf_s(pszStr, nLength, nLength, lpcwszFormat, marker);va_end(marker); //重置变量参数}wstring strResult(pszStr);delete[]pszStr;return strResult;}
0 0
- C++字符串格式化(FormatString)
- jqplot formatString 日期格式化列表
- FormatString
- FormatString
- FormatString
- C++/C字符串格式化
- C语言格式化字符串
- objective-c 字符串格式化
- C格式化字符串
- C 格式化字符串
- c的格式化字符串
- c格式化字符串
- c的格式化字符串
- C#DateTime字符串格式化
- C语言中格式化字符串
- [收藏]C语言格式化字符串
- C语言字符串格式化显示
- C/C++格式化字符串说明
- iOS UIWebView 自适应
- bzoj2754 后缀数组
- c#自定义事件
- C#图像处理教程 C# Tutorials for image processing
- android.support.v7.internal.app.WindowDecorAction问题记录
- C++字符串格式化(FormatString)
- ubuntu14.10下vmtools的安装
- solr5.4.0安装启动
- git常见操作和常见错误!错误提示:fatal: remote origin already exists.
- 机器学习中的数学(2)-线性回归,偏差、方差权衡
- 如何让你的Spark在快百倍?
- 另一种blast2go的思路
- jsp 静态引入<%@ include %> 动态引入<jsp:include> 区别
- MPEG-7 Visual Descriptors 视觉描述子