摘要:[cpp]: I/O -- stream definition One. [ stream picture ] 1. [ picture 1 ] 2. [ picture 2 ] Two. define [ stream ]: stream is an associated character se
阅读全文
随笔分类 - cpp
cpp语言编程
摘要:[os] xx.service文件编写 -- systemctl 一、 基本信息 1、 操作系统: Linux rocky 5.14.0-427.16.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 8 17:48:14 UTC 2024 x86_64 x
阅读全文
摘要:[c/cpp]: 函数的指针和函数数组的指针 一、 函数指针 1、 函数的指针:指向函数的指针,叫做“函数的指针”。 2、 函数数组的指针:指向函数数组的指针,叫做“函数数组的指针”。 二、代码: g++ -std=c++20 -O2 -Wall -pedantic -pthread main.cp
阅读全文
摘要:[cpp]: 双向链表的实现 一、思路或者原理 1、双向链表的实现思路: 1.1、【链节】:【链节】是【链表】的基本单位; 1.2、【链表】:由多个【链节】组成一个【链表】。 2、【链节】(data class):【链节data】是组成【链表chains】的基本单元,【链节data】用于存储数据。
阅读全文
摘要:[cpp]: my_systemcall() 一、说明 1、 C语言可以用【struct】替代C++的【class】。 二、代码 1 #include <iostream> 2 #include <string> 3 4 5 // system_calls tables 6 class c_sys_
阅读全文
摘要:[cpp]: thread -- with header <syncstream> 一、说明: 1、 【并发编程】thread编程中的同步输出: std::osyncstream // Defined in header <syncstream> 二、程序代码 1 #include <iostrea
阅读全文
摘要:[cpp]: 常量字符串的声明(const char* const localeName = "zh_CN.utf-8") 一、说明 1、编译环境: g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.83.0-gcc-13.2.0/include -s
阅读全文
摘要:[cpp]: c_string 类的实现(bug) 一、说明 1、当每个【c_string对象】到达自身的生命周期时,这个【c_string对象】为什么不调用自身的析构函数【 ~c_string() 】 ? 二、源程序 1 #include <iostream> 2 #include <string
阅读全文
摘要:[cpp]: 【字符】和【ascii值】之间的转换 一、基础: 1、将【字符】转化为【ascii值】( char -> int ): 1 char c = '-' ; 2 3 // char -> int 4 int c_out = int(c) ; 2、将【ascii值】转化为【字符】( int
阅读全文
摘要:[c][cpp]: c和cpp的命名规则(变量、函数、类、结构、枚举、共用) 一、说明:为了更好识别变量、函数、类、结构体,因此制定命名规则 1、全局变量的命名规则: g_<变量名> 2、函数的命名规则: f_<函数名> 3、【class(类)】的命名规则: c_<类名> 4.1、类的成员变量的命名
阅读全文
摘要:[os]:linux 【系统调用的编号】- SYSCALL_NUMBER 一、基本说明 1、操作系统:fedora38 2、【系统调用的编号】所在路径和名称: [ /usr/include/asm-generic/unistd.h ] 二、系统调用编号的源码【文件路径和名称: /usr/includ
阅读全文
摘要:[cpp][data_structure]: queue -- user defined( bug ) 一、示意 二、源代码中存在的问题 1、 有问题;在pop()中front指针设置有问题。 三、源码 1 #include <iostream> 2 #include <string> 3 4 5
阅读全文
摘要:[c][cpp]: c(cpp) connect to MariaDB -- (Codes) 一、注意事项 1、操作系统: 【 fedora38 】 2、c/cpp 连接 MariaDB数据库,需要使用额外的文件。 3、头文件【 /usr/include/mysql/mysql.h 】:mysql.
阅读全文
摘要:[c][cpp]: C/Cpp connector for MariaDB 一、必要说明 1、【 操作系统 】: 【 fedoral38 】 2、【 mysql.h 】文件位置: 【 /usr/include/mysql/mysql.h 】 二、相关文档 1、 C & C++ Connectors
阅读全文
摘要:[c]: 语言环境设置 -- setlocale() 一、语言环境设置【 Linux - Fedora 】 1、【Linux -- 类redhat 】语言环境设置 1.1、查看语言环境【/etc/locale.conf】:/etc/locale.conf 2、【Linux -- 类debian 】语
阅读全文
摘要:[c][cpp]: decimal to binary 一、源码 1 #include <stdio.h> 2 3 4 // decimal to binary; 10 -> 2 5 void dec2bin(long int num) 6 { 7 int res[1000]; 8 9 long i
阅读全文
摘要:[cpp]: 好玩的“宏定义(macro)” 一、有趣的“宏定义” 1、思想/原理:用【宏macro】,定义【伪指令directive】。 2、命令格式: #define [directive_name] [function or ...] 3、应用实例: 1 // directive entry
阅读全文
摘要:[cpp]: operator""s -- <string> 1 operator""s : 将一个字符数组字面量转化为【basic_string】类型数据。 1.1 #include <string> 1.2 operator""s : converts a character array lit
阅读全文
摘要:[c]: 计算机编程总结 -- 数据处理 计算机编程,主要工作是数据输入、数据处理、数据输出。在计算机编程中,常见的数据操作有: 一、‘字符串’的处理; 二、‘日期’的处理; 三、‘文件’的读写; 四、‘标准设备’的输入输出。
阅读全文
摘要:[cpp]: 以模板作为模板参数 -- <template> 一、template 说明 1、模板参数:以‘模板’作为模板的参数。 2、示例 1 // template<class T1, class T2> class W:模板参数W 2 // W<T1, T2>: W有两个参数【T1, T2】
阅读全文

浙公网安备 33010602011771号