1.方法声明 在函数声明时,在其名字之前放上一个变量,即是一个方法。这个附加的参数会将该函数附加到这种类型上,即相当于为这种类型定义了一个独占的方法。 package main import "fmt" type People struct { name string age uint8 } fun ...
分类:
其他好文 时间:
2020-08-26 18:54:13
阅读次数:
53
在Linux内核中,用struct cdev来表示字符设备。
分类:
系统相关 时间:
2020-08-26 18:30:57
阅读次数:
49
最近看了《Linux设备驱动详解这本书》,简单总结Linux设备驱动开发的一些基础知识。
分类:
系统相关 时间:
2020-08-25 18:38:10
阅读次数:
58
goshell执行优化版+输出结果为table格式packagemainimport("fmt""github.com/modood/table""golang.org/x/crypto/ssh""io/ioutil""net""time")funcconnect(user,password,host,keystring,portint,cipherList[]string)(*ssh.Sessi
分类:
系统相关 时间:
2020-08-25 15:55:00
阅读次数:
59
C++中读取文件可以采用几个函数分别为,_findfirst、_findnext、_findclose。其中还要借助结构体 struct _finddata_t,_finddata_t主要用来存储各种文件的信息。 struct _finddata64i32_t { unsigned attrib; ...
分类:
编程语言 时间:
2020-08-21 16:43:25
阅读次数:
156
声明成员变量 class CMyCtrl/CMyView : public CListCtrl/CListView { ... public: CMyCtrl/CMyView(); // 构造函数 protected: const int m_nMinWidth = 80; // 最小列宽(如果不需 ...
分类:
编程语言 时间:
2020-08-20 18:56:44
阅读次数:
64
2020.08.05 1、多线程 2、IPC、共享内存 3、bind 4、合并n个有序链表 (力扣原题 使用最小堆会快一些) #include <queue> using namespace std; struct ListNode { int val; ListNode* next; ListNo ...
分类:
其他好文 时间:
2020-08-20 18:20:10
阅读次数:
118
约瑟夫问题: #include <stdio.h> #include <stdlib.h> typedef struct node{ int data; struct node * next; }node; //创建一个有n个结点的循环链表 node * initLink(int n){ node ...
分类:
其他好文 时间:
2020-08-20 18:19:30
阅读次数:
49
自己之前纠正过这个问题,但还是忘了。今天再拿出来。 今天主要总结关于使用 c++ 标准中的 new 关键字。 【结论】 A、处理new可能抛出的异常 B、针对new使用std::nothrow不抛出异常 1、错误示范 下面一段代码,使用new向堆申请空间,再释放的过程 1 char *pbuf = ...
分类:
编程语言 时间:
2020-08-20 18:16:43
阅读次数:
76
int height(struct TreeNode* root) { if (root == NULL) { return 0; } else { return fmax(height(root->left), height(root->right)) + 1; } } bool isBalanc ...
分类:
其他好文 时间:
2020-08-19 19:58:57
阅读次数:
65