C++ std::string和C字符串之间的问题
2016-04-22 16:00
316 查看
今天写的代码遇到了这个问题,这里记录一下,有时间整理:
代码的输出是“wuwu”,也就是说不相等。
#include <string> #include <iostream> #include <stdlib.h> int main(){ //std::string str; std::string str(""); if (str.c_str() == "") std::cout << "haha" << std::endl; else std::cout << "wuwu" << std::endl; system("pause"); return 0; }
代码的输出是“wuwu”,也就是说不相等。
相关文章推荐
- OpenCV2.4.10之samples_cpp_tutorial-code_learn-----ImgTrans(仿射变换)
- C++单词统计(文件流、正则的应用)
- C++ 常用类型转换的区别
- 深入理解C++中的mutable关键字
- C++内存管理
- C++之浅谈类与对象
- C++类的对象和类的指针的区别
- PAT (Basic Level) Practise (中文)1033. 旧键盘打字(20)
- C/C++自动生成makefile工具 supermake
- VS中的路径宏 vc++中OutDir、ProjectDir、SolutionDir各种路径
- 如何在windows系统的cmd命令行下调用VS编译器
- C++第四次上机实验-项目2
- C++中虚析构函数的作用
- Visual Studio 13编译MYSQL CONNECTOR C/C++ (MYSQLCPPCONN)
- c++ 指针、引用、内存管理、函数(引用、重载、内敛)——c++复习(一)
- C++002常见设计模式
- Hello ISAPI
- c++宏定义命令
- C++保存json文件(使用jsoncpp库)
- 在Visual Studio上构建C++的GUI框架wxWidgets的开发环境