- 博客(11)
- 收藏
- 关注
原创 for(auto x: array)注意点
#include<iostream> #include<vector> using namespace std; void print(vector<int> & v) { for (auto x : v) cout << x << ' '; cout << endl; } int main() { vector<int> v = { 1,2,3,4,5 }; print(v); for .
2022-03-08 23:23:05
616
原创 stat函数 ,fstat,lstat函数(UNIX)
关于Stat函数详解: 头文件: #include <sys/stat.h> #include <unistd.h> int stat(const char *file_name, struct stat *buf); 通过文件名filename获取文件信息,并保存在buf所指的结构体stat中 返回值: 执行成功则返回0,失败返回-1,错误代码存于errno struct stat { dev_t st_dev; //文件的设...
2022-03-07 23:32:41
476
原创 Linux V4L2驱动编程
//打开设备 void UsbCam::open_device(void) { struct stat st; // camera_dev_为 /dev/video0设备文件名 //获取设备文件的属性 if (-1 == stat(camera_dev_.c_str(), &st)) { ROS_ERROR_STREAM("Cannot identify '" << camera_dev_ << "': " << errno &l.
2022-03-07 23:26:22
556
原创 智能指针之shared_ptr基本概述
1.shared_ptr允许有多个指针指向同一个对象,unique_ptr独占所指向的对象。 2.类似于vector,智能指针也是模板。创建智能指针: 1 shared_ptr<string> p1; //指向string的shared_ptr 2 shared_ptr<list<int>> p2; //指向int的list的shared_ptr 使用make_shared函数分配一个对象并初始化它,make_shared函数返回一个指向此对
2022-02-17 21:50:35
2137
转载 wget常见命令参数
转载来自https://www.cnblogs.com/mike168/p/11355420.html 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
2022-02-17 21:47:48
997
原创 boost::asio::deadline_timer的使用
#include <iostream> #include <boost/asio.hpp> #include <boost/thread.hpp> #include <boost/date_time/posix_time/posix_time.hpp> using namespace std; void Print(const boost::system::error_code &ec, boost::asio::dead.
2022-02-17 21:42:34
225
原创 Tinyxml的简单使用
源码下载地址:https://sourceforge.net/projects/tinyxml/ 学习可参考源码xmltest.cpp //简单示例代码 int GerXmlConfigData() { int count = 0; TiXmlNode *node = 0; TiXmlElement *todoElement = 0; TiXmlElement *itemElement = 0; vector<st_wifi_data> v
2022-02-17 21:30:48
352
原创 关于C++调用python的代码示例
#include <Python.h> #include <iostream> using namespace std; class Py_Operate { public: PyObject *pModule; PyObject *pDict; PyObject *pFunc; PyObject *pArgs; PyByteArrayObject *pImgArr; public: Py_Operate() : pMo.
2022-02-17 21:22:21
889
原创 Websocket++编程2-函数解释
add_subprotocol()[1/2] template<typename config > voidwebsocketpp::connection< config >::add_subprotocol ( std::string const & request ) Adds the given subprotocol string to the request list (exception) Adds a subpro...
2022-02-17 21:14:05
2781
原创 WebSocket++编程1
公共类型: #include <connection.hpp> Public Types typedefconnection< config > type 此连接的类型 Type of this connection. typedef lib::shared_ptr<type> ptr 指向此连接的共享指针的类型 Type of a shared pointer to this connectio...
2022-02-17 21:09:38
1748
原创 Python 多态性
1.方法的覆写:子类继承父类后可以根据父类的方法名称进行方法体的重新定义。 2.对象多态性:在方法覆写的基础上利用相同的方法名称作为标准,就可以在不考虑具体类型的情况下实现不同子类中相同方法的调用 实例:方法覆写 class Channel: def build(self): print("通道连接") class DatabaseChannel(Channel): def build(self): print("数据库通道连接")
2022-01-13 15:43:00
751
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅