随笔分类 -  C/C++

摘要:才用15000个数据 push_back耗时就好几秒, 解决方法是 先resize 15000, 然后再 for (int i = 0; i < 15000; i++) { Data data; m_dataVect[i] = data; } 没详细用时间戳试过减少多少时间,感觉可以节省5~10倍的 阅读全文
posted @ 2018-04-16 10:47 奥雷连诺 阅读(1476) 评论(0) 推荐(0) 编辑
摘要:class const的两个用法 1. const修饰对象不能修改对象, 2. const在成员函数右边表示不能修改成员变量, 这两个是联系在一起的,也就说明const在成员函数右边是不能重载的 阅读全文
posted @ 2018-04-09 11:58 奥雷连诺 阅读(1433) 评论(0) 推荐(0) 编辑
摘要:vector selVect; int count = m_consumeList.GetItemCount(); //你的列表多少行 for (int i = 0; i<count; i++) { if (CDIS_GRAYED == m_consumeList.GetItemState(i, CDIS_GRAYED)) //获得是否选中的行 { selVect.... 阅读全文
posted @ 2016-10-27 12:27 奥雷连诺 阅读(1965) 评论(0) 推荐(0) 编辑
摘要:bool bExist = false;HANDLE hHandle = ::CreateEvent(NULL, FALSE, FALSE, L"Global\\xxxxx_name");if (hHandle && ERROR_ALREADY_EXISTS == GetLastError()){ ... 阅读全文
posted @ 2015-01-29 11:00 奥雷连诺 阅读(1787) 评论(0) 推荐(0) 编辑
摘要:#include #include using namespace std;/**********************************//project -> Properties -> C/C++ -> Code Generation --> Enable C++ Exceptions... 阅读全文
posted @ 2014-12-22 10:50 奥雷连诺 阅读(4359) 评论(0) 推荐(0) 编辑
摘要:#include using namespace std;int main(){ vector resizeVect; vector reserveVect; resizeVect.resize(50, 2); //立即分配50个int,每个值为2,默认值为... 阅读全文
posted @ 2013-11-04 11:48 奥雷连诺 阅读(211) 评论(0) 推荐(0) 编辑
摘要:.h#pragma once#include #include #include #include using namespace std;class WininetFtpClient{public: WininetFtpClient(void); ~WininetFtpClient(v... 阅读全文
posted @ 2013-11-01 14:17 奥雷连诺 阅读(315) 评论(0) 推荐(0) 编辑
摘要://GBK转UTF8string CAppString::GBKToUTF8(const string & strGBK) { string strOutUTF8 = ""; WCHAR * str1; int n = MultiByteToWideChar(CP_ACP, 0,... 阅读全文
posted @ 2013-10-16 16:12 奥雷连诺 阅读(353) 评论(0) 推荐(0) 编辑
摘要:char strTtimeDump[512] = ""; int a = 5; sprintf(strTtimeDump, "%.4d", a); //strTtimeDump输出0005 数字前补3个0 sprintf(strTtimeDump, "%4d", a... 阅读全文
posted @ 2013-10-09 11:27 奥雷连诺 阅读(3465) 评论(0) 推荐(0) 编辑
摘要:#include //选择排序void SelectSort(int *p, const int length){ if (p == NULL) { return; } for (int i = 0; i p[j]) { ... 阅读全文
posted @ 2013-10-08 14:11 奥雷连诺 阅读(289) 评论(0) 推荐(0) 编辑
摘要:#include #include using std::string;using std::vector;int splitStringToVect(const string & srcStr, vector & destVect, const string & strFlag);int main... 阅读全文
posted @ 2013-06-25 17:52 奥雷连诺 阅读(2565) 评论(0) 推荐(0) 编辑
摘要:在解析读取tinyxml时候,发现读取汉字都是乱码,所以需要转成GBKstatic wstring ConvertUTF8toGBK(const char * strUTF8){int len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)strUTF8, -1... 阅读全文
posted @ 2013-03-31 15:45 奥雷连诺 阅读(524) 评论(0) 推荐(0) 编辑
摘要:#include#includevoid reverseArray(char *pArray){ int len = 0; while(*pArray++) { len++; } if(len == 0) { return ; } char * temp = new char[len +1]; f... 阅读全文
posted @ 2010-11-23 11:26 奥雷连诺 阅读(223) 评论(0) 推荐(0) 编辑
摘要:struct Test1{char name;int score;Student *pNext;};struct Test2{char name[3];int score;Student *pNext;};struct Test3{char name[6];int score;Stude... 阅读全文
posted @ 2010-11-19 10:49 奥雷连诺 阅读(190) 评论(0) 推荐(0) 编辑
摘要:转自秋阳@秋阳的软件测试专栏C++编码规范 1 前言本编码规范针对C++语言。制定本规范的目的:提高代码的健壮性,使代码更安全、可靠;提高代码的可读性,使代码易于查看和维护。本文档分别对C++程序的格式、注释、标识符命名、语句使用、函数、类、程序组织、公共变量等方面做出了要求。规范分为两个级别--规... 阅读全文
posted @ 2010-03-31 09:35 奥雷连诺 阅读(173) 评论(0) 推荐(0) 编辑
摘要:Sizeof与Strlen的区别与联系(转)1.sizeof操作符的结果类型是size_t,它在头文件中typedef为unsigned int类型。该类型保证能容纳实现所建立的最大对象的字节大小。2.sizeof是算符,strlen是函数。3.sizeof可以用类型做参数,strlen只能用cha... 阅读全文
posted @ 2009-11-30 15:05 奥雷连诺 阅读(127) 评论(0) 推荐(0) 编辑

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