随笔分类 -  小知识

1
摘要:# __attribute__((weak)): 可以定义两个相同的函数或变量,带__attribute__((weak))的为弱,如果有不带__attribute__((weak))的变量或函数以不带的为准,若没有则以带__attribute__((weak))为准; - test_1.c: `` 阅读全文 »
posted @ 2023-08-14 19:34 西北小蚂蚁 阅读(30) 评论(0) 推荐(0) 编辑
摘要:C语言预定义宏: #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { printf(" __FUNCTION__: %s\n", __func__); printf(" __func__: %s\n", __ 阅读全文 »
posted @ 2023-04-14 10:53 西北小蚂蚁 阅读(18) 评论(0) 推荐(0) 编辑
摘要:__builtin_popcount()函数 作用:__builtin_popcount ()用于计算一个 32 位无符号整数有多少个位为1 n = __builtin_popcount(val); 阅读全文 »
posted @ 2022-07-29 11:28 西北小蚂蚁 阅读(358) 评论(0) 推荐(0) 编辑
摘要:== 和 &的优先级熟高? 答案:==的优先级高于& 阅读全文 »
posted @ 2022-07-29 11:18 西北小蚂蚁 阅读(297) 评论(0) 推荐(0) 编辑
摘要:1、二进制数按位依次取出 代码: for(i = 0; i<32; i++) { a[i] = val & 1; val = val >> 1; } 2、清除二进制最低位的1 x = x & (x-1) 3、综合 阅读全文 »
posted @ 2022-07-25 13:55 西北小蚂蚁 阅读(27) 评论(0) 推荐(0) 编辑
摘要:Etcher版本太高有问题,下载个1.5.24版本的就行了 balenaEtcher-Setup-1.5.24-x64.exe 保留就行了 阅读全文 »
posted @ 2022-06-08 11:31 西北小蚂蚁 阅读(4772) 评论(0) 推荐(0) 编辑
摘要:每次都会更新 APP:pthread.c gcc -g $^ -o APP -lpthread R: ./APP cl: rm -rf ./APP 每次都需要删除后再次编译才能更新 APP: gcc -g pthread.c -o APP -lpthread R: ./APP cl: rm -rf 阅读全文 »
posted @ 2022-05-20 19:52 西北小蚂蚁 阅读(32) 评论(0) 推荐(0) 编辑
摘要:![](https://img2022.cnblogs.com/blog/2468371/202205/2468371-20220513113412690-521381443.jpg) ![](https://img2022.cnblogs.com/blog/2468371/202205/2468371-20220513113425426-1284812033.jpg) ![](https://i 阅读全文 »
posted @ 2022-05-13 11:36 西北小蚂蚁 阅读(23) 评论(0) 推荐(0) 编辑
摘要:1、首先需要一个写好的qt工程 2、使用Release编译运行写好的程序。(在QT右下角修改) 3、在生成的文件里面找到那个.exe文件 4、将此exe文件复制一份出来到自己创建的新的文件夹下,(此文夹需要在全英文路径下·) 5、在搜索里面搜qt找到qt自带的命令行 6、用cd /d 路径 的方式来 阅读全文 »
posted @ 2022-04-26 14:54 西北小蚂蚁 阅读(5958) 评论(2) 推荐(4) 编辑
摘要:c++里面几个字节对齐用:(如下为2字节对齐) #pragma pack(2) 阅读全文 »
posted @ 2022-04-22 20:17 西北小蚂蚁 阅读(49) 评论(0) 推荐(0) 编辑
摘要:1、请写出static关键字尽可能多的作用,至少两点。 C语言: (1)static修饰局部变量,会延长局部变量的生命周期。只会被初始化一次。 (2)static修饰全局变量和函数都表示隐藏,表示只能在本文件内使用,不允许被外部变量调用。 c++: static用来修饰的是类中的成员变量和成员函数, 阅读全文 »
posted @ 2022-04-19 13:48 西北小蚂蚁 阅读(27) 评论(0) 推荐(0) 编辑
摘要:ifconfig eth0 192.168.4.100 netmask 255.255.255.0 阅读全文 »
posted @ 2022-04-08 14:56 西北小蚂蚁 阅读(29) 评论(0) 推荐(0) 编辑
摘要:计算文件大小: #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdio.h> # 阅读全文 »
posted @ 2022-04-04 15:23 西北小蚂蚁 阅读(288) 评论(0) 推荐(0) 编辑
摘要:安装包:.deb dpkg -i 要安装的文件名 阅读全文 »
posted @ 2022-04-02 17:55 西北小蚂蚁 阅读(82) 评论(0) 推荐(0) 编辑
摘要:fgets可能会将'\n'当做字符录进去 #include <stdio.h> int main(void) { char a[10] = {'\0'}; printf(">>>"); fgets(a,6,stdin); printf("%s\n",a); return 0; } 结果: 结论: 从 阅读全文 »
posted @ 2022-04-01 19:08 西北小蚂蚁 阅读(137) 评论(0) 推荐(0) 编辑
摘要:例:如果umask的值为022,创建文件时指定的权限是775,则该文件的实际权限为 步骤: 1、022和775先变为二进制 022 >000 010 010 755 >111 101 101 2、022的二进制取反 000 010 010 >取反 >111 101 101 3、022取反后和755相 阅读全文 »
posted @ 2022-04-01 18:51 西北小蚂蚁 阅读(117) 评论(0) 推荐(0) 编辑
摘要:针对fopen、fread。。。 fseek(fr,10,SEEK_SET);//指针偏移到文件开始后10字节的地方 fseek(fr,-10,SEEK_END);//指针偏移到末尾前10字节的地方 针对open、read。。。 lseek(fr,10,SEEK_SET);//指针偏移到文件开始后1 阅读全文 »
posted @ 2022-03-28 10:52 西北小蚂蚁 阅读(35) 评论(0) 推荐(0) 编辑
摘要:一行代码: sudo apt-get install virtualbox-guest-dkms 搞完重启就好了; 阅读全文 »
posted @ 2022-03-22 14:59 西北小蚂蚁 阅读(271) 评论(0) 推荐(0) 编辑

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