VS2010不能将参数 1 从“std::string”转换为“const char *”解决
来源:互联网 发布:加拿大和中国知乎 编辑:程序博客网 时间:2024/05/18 02:13
环境:VS2010
代码:int len = strlen(str);//求字符串长度
解决:
std::string类有一个方法叫c_str()就是取出string对象的字符串,实现到char *的转换,调用方法:strlen(str.c_str());
总结:strlen只能用于c风格字符串,不能用于string,因为strlen是在遇到\0时结束判断的。用这个strlen(a.c_str())方法把string转换成c风格字符串即可解决。
0 0
- VS2010不能将参数 1 从“std::string”转换为“const char *”解决
- VS2010不能将参数 1 从“std::string”转换为“const char *”解决
- VS2010不能将参数 1 从“std::string”转换为“const char *”解决
- VS2010不能将参数 1 从“std::string”转换为“const char *”解决
- 如何解决error C2664: “atof”: 不能将参数 1 从“std::string”转换为“const char *”
- VS2013不能将参数 1 从“std::string”转换为“const char *”解决
- error C2664: “countChar”: 不能将参数 1 从“char [20]”转换为“std::string &”
- VS2010点滴——不能将参数 1 从“const char [11]”转换为“LPCWSTR”
- VS2010 编码问题 不能将参数 1 从“ATL::CStringT<BaseType,StringTraits>”转换为“const char *”
- VS2010点滴——不能将参数 1 从“const char [11]”转换为“LPCWSTR”
- VS2010点滴——不能将参数 1 从“const char [11]”转换为“LPCWSTR”
- VS2010点滴——不能将参数 1 从“const char [11]”转换为“LPCWSTR”
- VS2010 error C2664: “GetModuleHandleW”: 不能将参数 1 从“const char [10]”转换为“LPCWSTR” 解决方法
- VS2010下error C2664: “atoi”: 不能将参数 1 从“CString”转换为“const char *”
- 不能将参数 1 从“std::string”转换为“const wchar_t *”
- 不能将参数 1 从“std::string”转换为“const wchar_t *”
- 不能将参数1从“const char []”转换为“LPCTSTR
- 不能将参数1从“const char []”转换为“LPCTSTR
- 矩阵微分
- 计算a、b字符串的不连续公共子串的长度(包含c字符串) ----hdu4681
- 关于产品的一些思考——淘友天下之觅觅
- 这时可以借助微软网盘OneDrive的技
- 《30天自制操作系统》学习笔记——暂停
- VS2010不能将参数 1 从“std::string”转换为“const char *”解决
- hibernate连接mysql数据库自动插入数据
- POJ1611 The Suspects
- MFC中一些函数的用法
- Flex4.5+Eclipse3.6+blazeds+tomact6.0+JDK1.6集成
- DELPHI文件流
- 让你的网站使用个性化字体
- 翻纸牌 高校俱乐部 英雄会 csdn
- GET POST方法