摘要: 1. OPEN umask=2, 666&(~2)=664 2. CLOSE 3. Read 4. write 模拟 cat: 需求: 写hello到一个文件,然后读取,输出到终端。 若这样写,read不到,因为写hello后将到文件末尾。 需要lseek lseek 计算文件大小 少了一句: cl 阅读全文
posted @ 2020-02-21 16:51 feibilun 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 使用gdb: 编译时加-g参数 gcc -o app -I ./ func.c main.c -g 启动gdb: gdb app 在gdb启动程序: r(un) 启动 start 启动 停留在main函数,分步调试 n(ext) 下一条语句 s(tep) 下一条语句,可以进入到函数内部 q(uit) 阅读全文
posted @ 2020-02-21 10:09 feibilun 阅读(130) 评论(0) 推荐(0) 编辑
摘要: makefile 三要素: 目标 依赖 规则命令 写法: 目标:依赖 规则命令 v1: 缺点: 如果更改其中一个文件,所有源码都需要重新编译 可以考虑编译过程分解,先生成.o文件,使用.o文件得到结果 v2: 这样做的话,如果改变main.c,只需重新编译main.c, add.c sub.c无需重 阅读全文
posted @ 2020-02-20 17:57 feibilun 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 静态库文件命名: libxxx.a 制作步骤: 1. 编译为.o文件 2.将.o文件打包: ar rcs libxxx.a file1.o file2.o 3.将头文件与库一起发布 使用: gcc main.c -o app -I ./include/ -L lib/ -lxxx 动态库文件命名: 阅读全文
posted @ 2020-02-18 22:12 feibilun 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1. copy:yy (当前行) ,5yy(当前以及下面共五行) 正常模式下2. paste:p 正常模式下复制到光标下一行 P 复制到当前行 3. delete one line: dd, 5dd(5 lines) 正常模式下 4. x 删除光标位置内容 5. dw 删除一个单词 6. d$ 删除 阅读全文
posted @ 2020-02-18 17:51 feibilun 阅读(85) 评论(0) 推荐(0) 编辑
摘要: Link /* // Definition for a Node. class Node { public: int val; vector<Node*> children; Node() {} Node(int _val) { val = _val; } Node(int _val, vector 阅读全文
posted @ 2020-02-17 12:08 feibilun 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Link Solution: f[i][j]= 1 if i cats can make up j blood. f[0][0]=1 #include <bits/stdc++.h> # define LL long long using namespace std; int n; int a[21 阅读全文
posted @ 2020-02-14 18:18 feibilun 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Link Solution: Get the posistions of numbers of P2 in P1, find the LIS in this position array. #include <bits/stdc++.h> # define LL long long using na 阅读全文
posted @ 2020-02-14 10:49 feibilun 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Link class Solution { public: int lengthOfLIS(vector<int>& nums) { int n=nums.size(); if(n==0) return 0; vector<int> dp(n+1); int len=1; dp[1]=nums[0] 阅读全文
posted @ 2020-02-14 10:39 feibilun 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Link Solution: ans=sum of total triangles - sum of triangles with different colors Define the angle with different edge as D-angle. Consider triangles 阅读全文
posted @ 2020-02-11 12:23 feibilun 阅读(297) 评论(1) 推荐(0) 编辑