![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
笔记
CyanNoah
这个作者很懒,什么都没留下…
展开
-
linux下简单的制作一个C++动态链接库
这是我们的头文件,只定义了一个加法函数 dylib_test.h #ifndef OBJECT_DYLIBTEST_H #define OBJECT_DYLIBTEST_H #include <iostream> namespace dylib_test { int add(int a, int b); } #endif 这是执行文件 dylib_test.cpp #include "dylib_test.h" namespace dylib_test { int a原创 2022-04-06 18:41:54 · 2494 阅读 · 0 评论 -
C++boost库信号槽的使用
C++boost库信号槽的使用为什么使用信号槽使用的库例程 为什么使用信号槽 为了解耦,因为建设一定规模的程序时,为了未来的可维护性扩展性,使用信号槽是个不错的想法。 好比某道菜可能有多个方法去制作,所以我们在炒制的地方标注根据客人需求制作,这样就不至于客人需求不一样时就需要给厨师一份新的菜谱为了替换菜谱上的某个小地方,这样实现了解耦。 使用的库 我们这里使用boost的信号槽库,安装boost库后可以包含以下来使用库中的方式实现功能。 #include <boost/signals2.hpp>原创 2022-03-08 17:44:35 · 1440 阅读 · 0 评论 -
C++读写yaml文件
C++下读写yaml文件的部分代码 #include "yaml-cpp/yaml.h" #include <fstream> #include <iostream> YAML::Node yamlTest = YAML::LoadFile(_dir + "/yamlTest.yaml"); ofstream fout(_dir + "/yamlTest.yaml"); test_str = yamlTest["name"].as<string>原创 2020-12-29 17:40:31 · 1899 阅读 · 0 评论 -
string转char,消除string或者字符串中最后一位
可以通过互相转来用erase来消除最后一位 string str_ = "abcdefg"; const char* ch_; str_.erase(str_.end() - 1); ch_ = str_.data();原创 2020-12-22 18:12:23 · 192 阅读 · 0 评论 -
Linux下读取文件夹下所有文件的名字,大小,日期,放在一个数组中输出
研究了学习了一下这个功能,放上自己调试后的代码 #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <time.h> int stat( const char *path, struct _stat *buffer ); bool GetFileInfo(std::string path, std::vector<std::string&原创 2020-12-22 18:04:47 · 462 阅读 · 0 评论 -
CRC8 累加和,和校验算法
今天遇到一个需要和校验的地方,其所需的和校验方法其实很简单,但很多网上的算法取反后不适用,贴一下自己校验成功的算法。 hex下55 aa 80 01 01校验结果为81 uint8_t check_sum(const uint8_t *buffer, int size) { uint8_t i; uint8_t cr = 0; for(i=0; i<size; i++) { cr += *(buffer++); } return cr;原创 2020-11-23 18:34:27 · 1816 阅读 · 0 评论