随笔分类 -  C/C++

摘要:https://blog.csdn.net/q278233370/article/details/99681142 输入一个目录,输出目录下面所有文件的大小时间戳 #include <unistd.h> #include <stdio.h> #include <errno.h> #include < 阅读全文
posted @ 2020-08-10 11:05 cicero 阅读(319) 评论(0) 推荐(0) 编辑
摘要:官方例子 // thread example #include <iostream> // std::cout #include <thread> // std::thread #include <unistd.h> using namespace std; void foo() { // do s 阅读全文
posted @ 2020-06-08 15:20 cicero 阅读(192) 评论(0) 推荐(0) 编辑
摘要:记录一个笔试题,下面哪里会报错 #include <stdio.h> struct S { int i; int *p; }; int main() { S s; int *p = &s.i; p[0] = 3;//i=3,s.p=0; p[1] = 4;//i=3,s.p=4 s.p = p;// 阅读全文
posted @ 2020-05-12 17:35 cicero 阅读(96) 评论(0) 推荐(0) 编辑
摘要:C++标准库中的<sstream>提供了比ANSI C的<stdio.h>更高级的一些功能,即单纯性、类型安全和可扩展性 定义一个通用的转换模板,用于任意类型之间的转换。函数模板convert()含有两个模板参数out_type和in_value,功能是将in_value值转换成out_type类型 阅读全文
posted @ 2020-04-02 09:37 cicero 阅读(205) 评论(0) 推荐(0) 编辑
摘要:#include <stdlib.h> #include <iostream> #include <time.h> #include <string> #include <stdio.h> using namespace std; int main(int argc, char* argv[]) { 阅读全文
posted @ 2020-03-12 10:54 cicero 阅读(973) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h>#include <string.h> bool isIP(const char* str); int main(){ char str[] = "111.111.111.21"; char str2[] = "a.111.111.111"; char str3[ 阅读全文
posted @ 2019-12-17 11:18 cicero 阅读(1769) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/TenosDoIt/p/3456704.html 阅读全文
posted @ 2019-12-03 09:04 cicero 阅读(150) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/jonathan321/article/details/78106101 阅读全文
posted @ 2019-11-28 13:18 cicero 阅读(155) 评论(0) 推荐(0) 编辑
摘要:如果成员变量在初始化列表中, 就会执行该变量类型的拷贝构造函数. 如果成员变量没有在初始化列表中, 就会执行该变量类型的缺省构造函数. 阅读全文
posted @ 2019-10-31 15:54 cicero 阅读(489) 评论(0) 推荐(0) 编辑
摘要:下面是使用类模板实现的简单栈结构 模板定义很特殊。由template<…> 处理的任何东西都意味着编译器在当时不为它分配存储空间,它一直处于等待状态直到被一个模板实例告知。 标准要求编译器在实例化模板时必须在上下文中可以查看到其定义实体; 而反过来,在看到实例化模板之前,编译器对模板的定义体是不处理 阅读全文
posted @ 2019-09-28 17:19 cicero 阅读(411) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/gatieme/article/details/51959654 阅读全文
posted @ 2019-09-27 11:18 cicero 阅读(268) 评论(0) 推荐(0) 编辑
摘要:#include extern char** environ; int main() { int nIndex = 0; for(nIndex = 0; environ[nIndex] != NULL; nIndex++) { printf("%s\n",environ[nIndex]); } } ———————————————— 版权... 阅读全文
posted @ 2019-09-26 13:20 cicero 阅读(1301) 评论(0) 推荐(0) 编辑
摘要:在“[]”包括起来的是捕捉列表,捕捉列表由多个捕捉项组成,并以逗号分隔。捕捉列表有以下几种形式: 1.[var]表示值传递方式捕捉变量var;2.[=]表示值传递方式捕捉所有父作用域的变量(包括this);3.[&var]表示引用传递捕捉变量var;4.[&]表示引用传递方式捕捉所有父作用域的变量( 阅读全文
posted @ 2019-08-22 16:07 cicero 阅读(523) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/luoyayun361/article/details/80428882 阅读全文
posted @ 2019-08-21 19:05 cicero 阅读(752) 评论(0) 推荐(0) 编辑
摘要:如何用使用stringstream进行类型转换: 1. 下面例子为整型和sting类型的相互转换示例 整型转换为字符串类型 string NumberToString(int num){ stringstream ss; ss<<num; //像流中传值 string result; ss>>res 阅读全文
posted @ 2019-08-19 17:52 cicero 阅读(3011) 评论(0) 推荐(0) 编辑
摘要:参考 https://www.cnblogs.com/god-of-death/p/7755250.html 参考 https://www.jianshu.com/p/6afdffe94d96 //threadpool.h #include <stdio.h> #include <stdlib.h> 阅读全文
posted @ 2019-08-14 19:44 cicero 阅读(286) 评论(0) 推荐(0) 编辑
摘要:std::string folderPath = "c:"+ "\\log"; std::string command; command = "mkdir -p " + folderPath; // system(command.c_str()); if (0 != access(folderPath.c_str(), 0)) { ... 阅读全文
posted @ 2019-06-20 12:06 cicero 阅读(259) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/jaken99/article/details/78231872 阅读全文
posted @ 2019-06-20 12:04 cicero 阅读(797) 评论(0) 推荐(0) 编辑
摘要:编译器会优先去调用普通函数,但是当函数模板有更好的匹配时或使用限定符<>时,编译器就会去匹配函数模板。 总结 - 函数模板是泛型编程在C++中的应用方式之一 - 函数模板能够根据实参对参数类型进行推导 - 函数模板支持显示的指定参数类型 - 函数模板是C++中重要的代码复用方式 - 函数模板通过具体 阅读全文
posted @ 2019-05-19 12:43 cicero 阅读(171) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示