C++将不同编码的字符串写入文件 c/c++

u8string 以文本模式进行保存 #include <fstream> #include <iostream> int main() { std::u8string u8str = u8"你好𣍐,世界!This is a UTF-8 string."; const char* filename = "output...
benojan 发布于 
article cover
benojan 发布于 

C++ DLL的制作与使用 c/c++

制作DLL // calc.h #ifdef EXPORT_DLL #define CALC_API __declspec(dllexport) #else #define CALC_API __declspec(dllimport) #endif extern "C" { CALC_API int 加(int a, int b); CAL...
benojan 发布于 

Accelerators and WTL Dialogs c/c++

Author: Rory Buchanan Date: 2006 Introduction I searched and searched the CodeProject but never found an example on using accelerators and WTL dialogs. I have used accelerators in ...
benojan 发布于 

MFC 控件使用之ListCtrl之一 c/c++

作者:lixiaosan 时间:04/06/2006 以下未经说明,listctrl默认view 风格为report 相关类及处理函数 MFC:CListCtrl类 SDK:以 “ListView_”开头的一些宏。如 ListView_InsertColumn 1. CListCtrl 风格 LVS_ICON: 为每个item显示大图标 LVS_SMALL...
benojan 发布于 

C++ 使用regex正则表达式 c/c++

案例 #include <iostream> #include <regex> using namespace std; int main() { string str{ "ang1\tm1-n1-ng1 ang1" }; regex e{ "(^|[ \\-\\s])([mn])(g*)1" }; co...
benojan 发布于 

C语言 c/c++

C编程常用 EXIT_SUCCESS // 退出成功 EXIT_FAILURE // 推出失败
benojan 发布于 

c语言静态库、动态库制作 c/c++

静态库制作及步骤 将 .c 生成 .o 文件 gcc -c add.c -o add.o 使用 ar 工具,制作静态库 ar rcs lib库名.a add.o sub.o div.o 编译静态库到可执行文件中 gcc test.c lib库名.a -o a.out 动态库制作及使用步骤 将 .c 生成 .o 文件 gcc -c add.c -o ad...
benojan 发布于 

关于C++里的查询 c/c++

一、str.find() 在字符串str中查询子串的位置 #include <iostream> using namespace std; int main() { string str = "abcdefg"; size_t pos = str.find("bcd"); if(pos != string::npos...
benojan 发布于 

boost的字符串操作 c/c++

头文件 #include <boost/algorithm/string.hpp> 功能 字符串切割 boost::algorithm::split() using namespace boost::algorithm; int main() { std::string s = "Boost C++ Libraries"; s...
benojan 发布于