![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++ 开发常用功能函数
伍铭
My life for aiur
展开
-
关于CRITICAL_SECTION锁的使用心得
1、通常锁处理代码class Sync{private: CRITICAL_SECTION m_cs;public: Sync() { ZeroMemory(&m_cs, sizeof(m_cs)); InitializeCriticalSection(&m_cs); } ~Sync() { DeleteCriticalSection(&...原创 2020-03-15 00:03:07 · 786 阅读 · 0 评论 -
二维vector迭代器的使用
迭代器遍历删除的正确用法 vector<int> veci; for (vector<int>::iterator iter = veci.begin(); iter != veci.end(); ) { if (*iter == 3) iter = veci.erase(iter); else iter++; }二维vector的迭代器...原创 2020-03-14 23:40:03 · 2063 阅读 · 0 评论 -
c++ http get请求或通知
char sendBuffer[1000] = { 0 }; char recvBuffer[1000] = { 0 }; sprintf_s(sendBuffer, "GET /router/code/notiAlert?msg=Plugin-MSG:test_msg_ignore! HTTP/1.1\r\nHost:testportal.tradecopier.info \r\n\r\n...原创 2020-02-22 17:11:22 · 421 阅读 · 0 评论 -
c++功能函数 字符类型转换
std::string WChar2Ansi(LPCWSTR pwszSrc){ int nLen = WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, NULL, 0, NULL, NULL); if (nLen <= 0) return std::string(""); char * pszDst = new char[nLen]; if...原创 2020-02-17 22:25:35 · 200 阅读 · 0 评论 -
C++ 数据对文件的读写函数
两个读写样例void SaveSubLoginsIntoFile(){ /*for (int i = 0; i <sublogins.size(); i++) { ExtLogger.Out("[%s] Sub login '%d'", __FUNCTION__, sublogins[i]); }*/ DeleteFileA(subLoginsFile.data()); ...原创 2020-02-13 11:54:09 · 584 阅读 · 0 评论 -
logger 日志类 unicode
logger.c#include "stdafx.h"#include <cstdio>#include "logger.h"using namespace std;//extern CServerInterface *ExtServer;Logger ExtLogger;extern string workingDir_;LPCWSTR Str...原创 2020-02-12 21:49:50 · 371 阅读 · 0 评论 -
创建线程thread
相关头文件#include <windows.h>#include <WinSock2.h>#include <WS2tcpip.h>#include <string>#include <vector>#include <time.h>#include <thread>#include <...原创 2020-02-12 21:27:40 · 130 阅读 · 0 评论 -
常用功能函数 logger 日志类 mutibyte
logger.cpp#include "stdafx.h"#include <cstdio>#include "logger.h"using namespace std;Logger ExtLogger;extern string workingDir_;Logger::Logger(void){}Logger::~Logger(vo...原创 2020-02-12 20:51:59 · 635 阅读 · 0 评论 -
通用函数1 vector map信息分割
#include <vector> <map> <iostream>void strAssignToChar(char *dest, unsigned int len, std::string &str){ const char *c = str.data(); memset(dest, 0, len); if (str.length(...原创 2020-02-12 20:42:44 · 202 阅读 · 0 评论