随笔分类 -  C/C++杂项

只有注册用户登录后才能阅读该文。
posted @ 2020-06-09 14:58 那一剑的風情 编辑
摘要:https://blog.csdn.net/chenzz2560/article/details/81198582 阅读全文
posted @ 2019-09-30 17:27 那一剑的風情 编辑
摘要:参见:https://www.cnblogs.com/lidabo/archive/2012/05/29/2524170.html VS 中各类文件作用 .sln,.suo,.vcxproj,.vcxproj.filters,.vcxproj.user 参见:https://blog.csdn.ne 阅读全文
posted @ 2019-08-07 10:50 那一剑的風情 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-03-15 16:43 那一剑的風情 编辑
摘要:char exchange(char c) { if (c = 'A') c = tolower(c); else if (c >= 'a' && c <= 'z') c = toupper(c); return c; } int main() { string strTmp = "short"; transform(str... 阅读全文
posted @ 2018-10-29 13:48 那一剑的風情 阅读(3412) 评论(0) 推荐(0) 编辑
摘要:方法一:使用 _CrtDumpMemoryLeaks main.cpp 第34行有内存泄漏 方法二:使用 DebugDiag 参见官方文档:https://msdn.microsoft.com/en-us/library/ff420662.aspx 生成dump文件: 默认下一步 如果是查内存泄漏: 阅读全文
posted @ 2018-09-27 17:58 那一剑的風情 阅读(547) 评论(0) 推荐(0) 编辑
摘要:输出结果: 如果把CBase的析构函数 virtual 去掉,输出结果: 此时,CDerived 的析构函数没有被调用,造成内存泄漏。 所以,基类的虚函数要定义成 virtual 的。这样,当一个基类的指针删除一个派生类对象时,派生类的析构函数会被调用。 阅读全文
posted @ 2018-09-27 16:59 那一剑的風情 阅读(192) 评论(0) 推荐(0) 编辑
摘要:项目属性->生成事件->预生成事件->命令行 阅读全文
posted @ 2018-09-11 10:20 那一剑的風情 阅读(250) 评论(0) 推荐(0) 编辑
摘要:场景: 原因: _findfirst 函数返回类型是 intptr_r 解决方法: long handle 改为 intptr_t handle 阅读全文
posted @ 2018-09-11 10:05 那一剑的風情 阅读(347) 评论(0) 推荐(0) 编辑
摘要:场景: 解决方法: #include <algorithm> std::find 阅读全文
posted @ 2018-09-11 09:55 那一剑的風情 阅读(435) 评论(0) 推荐(0) 编辑
摘要:void trimString(std::string & str ) { int s = str.find_first_not_of(" "); int e = str.find_last_not_of(" "); str = str.substr(s,e-s+1); return; } 阅读全文
posted @ 2018-07-11 16:08 那一剑的風情 阅读(861) 评论(0) 推荐(0) 编辑
摘要:场景: 原因: 抽象类不能实例化,需要在派生类中实现基类所有定义的纯虚函数,只要有一个纯虚函数没有定义,那么派生类还是抽象类。仍然不能实例化。 解决方法: 阅读全文
posted @ 2018-07-11 15:45 那一剑的風情 阅读(3455) 评论(0) 推荐(0) 编辑
摘要:场景: git 拉取 VS 2015 项目,打开之后,.h头文件和.cpp文件混在一起了。 解决方案: 需要XXX..vcxproj.filters 文件。 阅读全文
posted @ 2018-06-29 16:29 那一剑的風情 阅读(1711) 评论(0) 推荐(1) 编辑
摘要:void StringReplace(string &str, string srcSubStr, string decSubStr) { int iPos = 0; while (str.find(srcSubStr, iPos) != string::npos) { iPos = str.find(srcSubStr, iPos); str = str.replace(iPos... 阅读全文
posted @ 2018-06-07 15:19 那一剑的風情 阅读(325) 评论(0) 推荐(0) 编辑
摘要:double setDoublePrecision(double dInDate, int iPrecision = 4) { char buf[512] = {0}; char szPrecision[32] = {0}; sprintf(szPrecision, "%s%df", "%.", iPrecision); sprintf(buf, szPrecision... 阅读全文
posted @ 2018-06-07 15:16 那一剑的風情 阅读(795) 评论(0) 推荐(0) 编辑
摘要:str2= "hi,"+"volcanol"; 操作数类型 ‘const char [4]’ 和 ‘const char [9]’ 对双目 ‘operator+’ 而言无效。 原因上面的提示信息已经说的很明白了,const char类型不支持+ 操作。 + 操作符使用的时候,其左、右操作必须有一个是 阅读全文
posted @ 2018-02-08 17:26 那一剑的風情 阅读(1465) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示