随笔分类 - 程序设计
摘要:字符串数组是指针数组,需要使用二级指针 #include "stdafx.h" #include <stdio.h> #include <string.h> const char* str[] = { "Hello","abc","applef","man","C程序设计","指针数组" }; co
阅读全文
摘要:(1) 线程系统的三个基本要素:执行环境,调度,同步。 同步: 使用互斥量来保护共享数据,使用条件变量来通信,使用条件变量来通信,其他同步机制,如信号量管道和消息队列。互斥量允许线程在访问共享数据 锁定他,以避免其他线程干扰。条件变量允许线程等待共享数据到达某个期望的状态。(队列非空或者资源可用)
阅读全文
摘要:使用c库操作文件 #include "stdafx.h" #include <stdio.h> #include <pthread.h> #include <assert.h> #include <windows.h> #include <string.h> static void* Functio
阅读全文
摘要:我们写的代码最终都要编译成为二进制程序,然后这个程序放到内存里面去。 和多进程比较一下 区别
阅读全文
摘要:设备号 进程号 线程号 姓名 万物有个名字 万物通过名字来进行识别 多个同样性质的东西。
阅读全文
摘要:#include "stdafx.h" #include <pthread.h> #include <stdio.h> #include <windows.h> #include <stdio.h> //#include <assert.h> int main(int argc, _TCHAR *a
阅读全文
摘要:系统调用的函数api头文件 kernel\include\uapi\asm-generic #include <unistd.h> #include <sys/syscall.h> #include <sys/types.h> #include <signal.h> #include <stdio.
阅读全文
摘要:IO就是读数据或者写数据 包含一个时间概念在里面 包含一个system概念 读数据的策略 阻塞和非阻塞时设备访问的两种基本形式。使用这两种形式,驱动程序可以灵活地支持阻塞和非阻塞的访问。select函数底层实现,里面实现用就是等待队列。 阻塞调用时指调用结果返回之前,当前线程挂起。函数只有得到结果之
阅读全文
摘要:方法一 #include "stdafx.h" #include <stdio.h> #include <assert.h> #include <windows.h> #include <process.h> // 包含这个头文件就行 方法二 移植posix库: 移植官网: ftp://source
阅读全文
摘要:所有英文字符都是使用字符数组存储的,也就是打通了计算机与英语的联系。 static void strarray_printf(char *data, int len) { int i; for (i = 0; i < len; i++) { printf("0x%02x ", data[i]); }
阅读全文
摘要:- 0xce 如果是short类型表示 0xffce 表示负数 负数的10进制是很大的 。 -0xce 如果是int类型的话 0xffffffce 表示负数 负数的10进制也很大
阅读全文
摘要:共用体数据类型竟然是里面的独门绝技,牛逼的飞起,尤其是流媒体数据。
阅读全文
摘要:模块: 多个.c和.h 构成一个软件系 统 软件工程项目 #ifndef __TEST_STRUCT_H #define __TEST_STRUCT_H struct toilet_paper { int g_status; int color; int size; int shape; int o
阅读全文
摘要:struct my_Packet{ int xx; void *data; int size; }; 好处: 任意指针类型 需要做的事情: 引用的时候需要强制类型或者使用一个指针进行赋值,指向他。 方法一:char*pdata = pPacket->data; pdata[DATA_PACKET_L
阅读全文
摘要:|、 PS 查看进程 之后迅速往上滚动界面,终端显示会停止,就能找到想要的进程。
阅读全文
摘要:(1) 知道是什么果汁. (2) 打开果汁瓶盖. (3) 往里面倒雪碧或者果汁. (4) 直到果汁倒满. (5) 关闭啤酒瓶盖. O(n) = n =5; 任何接口的版本固件升级,都可以使用上面五步,比如(1)uart (2)net (3)usb
阅读全文
摘要:// tsk.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" int main() { while (1) { if (1) { continue; } printf("continue 使用\n"); } return 0; }
阅读全文

浙公网安备 33010602011771号