c++ 笔记


c++ string类字符串查找
https://blog.csdn.net/qq_45797026/article/details/108359461
实现插件加载卸载函数:
extern "C" UNTITLEDSHARED_EXPORT GxPluginPackage *CreatePluginPackage();
extern "C" UNTITLEDSHARED_EXPORT void ReleasePluginPackage();

c++ 线程:boost::async(boost::launch::async,std::bind(&TargetRecognizeRunner::run,this));
链接器:-lpthread

延时(ms):poll(0, 0, secs);

#pragma comment(lib, "ws2_32.lib")
#pragma comment (lib, "oes_api.lib")

1、atoi
功 能:把一字符串转换为整数
2、atol
功 能:把一字符串转换为长整形
3、atof
功 能:把一个字符串转换为双精度浮点数
4、strtod
功 能:将字符串转换为双精度浮点型值,并报告不能被转换的所有剩余数字
5、strtol
功 能:将字符串转换为长整形值,并报告不能被转换的所有剩余数字
6、strtoul
功 能:将字符串转换为无符号长整形值,并报告不能被转换的所有剩余数字。

//获取毫秒微秒
#include <sys/time.h>
struct timeval tv;
gettimeofday(&tv, 0);
tv.tv_usec / 1000;

//套接字忽略管道破裂信号
send(clientA_sockfd, send_len.data(), 5, MSG_NOSIGNAL);

/*
centos 修改文件夹权限: chmod -R 777 /path/ 
ps -aux | grep nginx 查看进程
*/

/*
获取当前时间
return:
now_timec: 当前string格式的时间
*/
std::string get_now_time() {
//时间序列
time_t t = time(0);
//当前时间,char
char now_timec[32] = { NULL };
//将时间序列转换为字符串
strftime(now_timec, sizeof(now_timec), "%Y-%m-%d.%H:%M:%S", localtime(&t));
return now_timec;
}

读写文件:
FILE *fp = NULL;
fp = fopen("TransLog.txt", "a+");
fprintf(fp, "This is testing for fprintf...\n");
fclose(fp);

linux库目录:D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\Linux\include\usr

vs_linux附加依赖项中添加:-lpthread

互斥锁----------------->
#include <mutex>
std::mutex m;
m.lock();
m.unlock();
<-----------------------

//bson->json->反序列化
json str = json::parse(bson_as_canonical_extended_json(doc, NULL));
//json序列化
std::string str = str.dump();
// 执行查询操作
cursor = mongoc_collection_find(collection, MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL);
cursor = mongoc_collection_find_with_opts(collection, query, NULL, NULL);

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值