c++
文章平均质量分 54
qq_20488317
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
c++ 通过stat确认是否更新文件
应用场景:项目需要对文件进行实时更新,即一旦文件进行修改,项目就读取这个文件的内容,进行更新。 struct stat fi;if(stat(file.c_str(), &fi) == 0 && fi.st_mtime != last_update_){***}//其中last_update_记录的是上次的更新时间即通过stat将file的文件状态,复制到参数fi所指的结构中。然后取出fi原创 2017-02-28 09:46:35 · 2761 阅读 · 1 评论 -
gcc 编译参数说明
gcc -Wno-deprecated -O3 -g -Wall -fno-strict-aliasing -fPIC -Wfloat-equal -Wno-unused-function -DPCRE_STATIC-O3少优化->多优化:O0 >> O1 >> O2 >> O3-O0表示没有优化,-O1为缺省值,-O3优化级别最高一般来说,Debug时不优化-原创 2017-07-18 17:36:06 · 532 阅读 · 0 评论 -
c++ 段错误 (core dumped )原因分析
程序可以编译通过,执行的时候遇到段错误段错误有各种原因,具体见博客:http://www.cnblogs.com/panfeng412/archive/2011/11/06/2237857.html下面介绍一下,我在实际项目中遇到的段错误及解决方法:原创 2017-07-07 12:14:07 · 3951 阅读 · 0 评论 -
不能将类型为‘std::string&’的非 const 引用初始化为类型为‘const char*’的临时变量
#include #include #include #include using namespace std;void bar(string &s){ std::cout<< s<< std::endl;}int main(){ bar("hello");}报错原因:hello作为临时对应是const类型,而bar这个函数的参数是非const类型,原创 2017-04-01 16:57:31 · 1672 阅读 · 0 评论 -
no instance of overloaded function "std::tr1::bind" matches the argument list
首先要检查函数的参数是否能完全匹配如果能匹配上,那应该是如下原因:"std::tr1::bind对”绑定函数的参数有限制,不能超过9个。原创 2017-04-01 16:13:23 · 3377 阅读 · 1 评论 -
c++ 处理中文标点符号
1、去掉字符串首尾的标点符号——英文str.erase(0, str.find_first_not_of(str_puncuation)); |str.erase(str.find_last_not_of(str_puncuation) + 1); 其中str_puncuation表示要删除的标点符号存在问题:处理的字符串包含中文时会原创 2017-02-26 19:33:22 · 6798 阅读 · 1 评论 -
linux c++ 多线程代码 对文件的读写
#include #include #include using namespace std;pthread_mutex_t file_mutex;void* product(void * arg){ for(int i = 0; i pthread_mutex_lock(&file_mutex); ofstream原创 2017-02-15 10:42:35 · 5268 阅读 · 1 评论 -
正态分布/卡方分布/F分布/T分布/泊松分布
统计学三分分布http://bbs.pinggu.org/thread-3885528-1-1.html原创 2017-10-23 11:43:36 · 3167 阅读 · 0 评论
分享