随笔分类 - c++
工作笔记
摘要:#include <iostream> #include <chrono> #include <ctime> #include <iomanip> #include <sstream> int main() { // 获取当前时间点 auto now = std::chrono::system_cl
阅读全文
摘要:#define STRINGIFY(x) #x int someVariable = 10; std::cout << STRINGIFY(someVariable) << " = " << someVariable << std::endl;
阅读全文
摘要:#include <iostream> #include <sstream> #include <iomanip> #include <ctime> bool compareTimeStrings(const std::string& timeStr1, const std::string& tim
阅读全文
摘要:#include <stdio.h> void print_binary(unsigned int n) { for (int i = sizeof(n) * 8 - 1; i >= 0; i--) { printf("%d", (n >> i) & 1); } printf("\n"); } vo
阅读全文
摘要:#include <iostream> #include <fstream> int main() { std::ifstream sourceFile("source.txt", std::ios::binary); // 打开源文件 if (!sourceFile) { std::cout <<
阅读全文
摘要:新手VSCode配置C++20 Makefile教程1 快速入门 HTTP 代理服务器的设计与实现(C++)
阅读全文
摘要:// testfindfile.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include <iostream> #include <windows.h> bool SearchFilesByWildcard(const WCHAR* wildcardPath)
阅读全文
摘要:// testmutex.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include <iostream> #include "windows.h" HANDLE m_hMutex; #include<list> using namespace std; lis
阅读全文
摘要:C++中将string类型转换为double的方法:#include <iostream>#include <sstream> //使用stringstream需要引入这个头文件using namespace std;//模板函数:将string类型变量转换为常用的数值类型(此方法具有普遍适用性)t
阅读全文
摘要://Log.h #ifndef LOG_HEAD_DEF #define LOG_HEAD_DEF #pragma once #include "stdio.h" #include <stdarg.h> ////用变参函数所必须的 #include <time.h> #include <direct
阅读全文
摘要:#include <iostream> #define new_fun(parm) print##parm("this is a printf\r\n"); int main() { //new_fun(oh); //无法编译通过 new_fun(f); getchar(); return 0; }
阅读全文
摘要://Minidump.h #pragma once class CMinidump { public: CMinidump(); ~CMinidump(); static void CreateDumpFile(LPCSTR lpstrDumpFilePathName, EXCEPTION_POIN
阅读全文
摘要:#include <iostream> void getfilename(const char* filename, char* name)//从完整路径名中解析出文件名称,例如:/home/test/abc.txt,解析完成后为abc.txt { int len = strlen(filename
阅读全文
摘要:#include <iostream> #include<direct.h> #include<io.h> bool CheckPathExist(std::string path) { if (access(path.c_str(), 0) == -1) { return false; } ret
阅读全文
摘要:// encripe_test.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include <string> #include <iostream> using namespace std; //int key[] = { 1,2,3,4,5,6,7 }; in
阅读全文