![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法及编程技巧
工作中用到的算法,多线程,线程池内存池等技术的使用记录
Ideal-life_L&T
生活的理想是为了理想的生活!
展开
-
CMake编写使用范例
可执行程序范例cmake_minimum_required(VERSION 3.11) //cmake的版本要求set(CMAKE_BUILD_TYPE Release) //通过set可以指定一些变量值及类型set(PROJECT_NAKE ePass3000GM) //指定工程名称project(${PROJECT_NAKE}) //工程FILE(GLOB SOURCE ${PROJECT_SOURCE_DIR}/s原创 2021-05-11 10:51:32 · 256 阅读 · 0 评论 -
cJson的使用,C语言解析Json字符串
/* Copyright (c) 2009-2017 Dave Gamble and cJSON contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restr.原创 2021-12-21 09:44:54 · 1713 阅读 · 0 评论 -
日志访问生成
1、C语言生成日志,设置文件大小日志文件写满自动从新开始,支持多线程操作。FILE *flog;char datestr[16];char timestr[16];char mss[4];pthread_mutex_t cs_log;void Log(const char *pszFmt,...) { va_list argp; pthread_mutex_lock(&cs_log); va_start(argp,pszFmt); struct t原创 2021-09-27 14:16:10 · 82 阅读 · 0 评论 -
C/C++配置文件读写操作
config.h#ifndef CONFIGFILE_H#define CONFIGFILE_H#include <string.h>#include <map>using namespace std;class ConfigFile{public: ConfigFile(); void readConfigFile(string fileName); void writeConfigFile(string fileName);原创 2021-08-04 11:39:57 · 710 阅读 · 0 评论 -
C/C++语言实现文件操作
1、如下代码可实现对文件大小得读取,并读取特定长度存取到特定位置。其中seekg可以移动文件流得其实位置,进而从不同位置读取不同长度得数据。 std::ifstream t; int length; t.open(strFileName.c_str()); // open input file t.seekg(0, std::ios::end); // go to the end length = t.tellg();原创 2021-08-04 11:21:48 · 140 阅读 · 0 评论 -
Linux函数调用使某个用户退出系统登录(本机登录)
#include <unistd.h>#include <utmp.h>#include <sys/msg.h>#include <sys/un.h>#include <sys/param.h>#include <sys/stat.h>void signal_term(const char *username){ struct utmp *tmp; while( (tmp = getutent()) .原创 2021-06-11 17:13:08 · 129 阅读 · 0 评论