08 2022 档案
摘要:转载地址:https://blog.csdn.net/jiemashizhen/article/details/125016646 core文件是调试段错误的重要手段,默认情况下是不会生成core文件的,可通过如下方式对生成core文件进行设置: 1.打开core开关 可以先通过ulimit -c,
阅读全文
摘要:一个初级的线程函数 创建10个线程,每个线程内进行计数操作,有锁. 对认识线程,有一定的帮助作用。 #include <iostream> // std::cout #include <thread> // std::thread #include <mutex> // std::mutex usi
阅读全文
摘要:一个linux程序 网络通信的服务器,监听某个端口号。这里的代码介绍了如何绑定ip地址,如何创建socket,如何设置Ip地址族等 #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sig
阅读全文
摘要:指针作为参数传递的时候,需要用指针的指针 作为参数 eg: 1 #include <iostream> 2 using namespace std; 3 4 int* p; 5 void func(int** a){ 6 *a = new int(5); 7 } 8 9 int main() 10
阅读全文
摘要:经常会忘记排序的比较函数,是从大到小排序的,还是从小到大排序的。 这里是一个排序函数的示例。不记得的时候经常来查看。 #include <iostream> #include <vector> #include <string> #include <algorithm> using namespac
阅读全文