05 2022 档案
摘要:## 编译时 gcc xx.c -o xx -pthread #include <stdio.h> #include <sys/types.h> #include <sys/ipc.h> #include <stdlib.h> #include <sys/msg.h> #include <strin
阅读全文
摘要:线程的互斥:使用线程互斥锁 初始化锁 #include <pthread.h> int pthread_mutex_init(pthread_mutex_t *restrict mutex,const pthread_mutexattr_t *restrict attr); 功能: 初始化互斥锁 参
阅读全文
摘要:线程的同步:用的是信号灯来实现 1. 线程信号灯的初始化 - include <semaphore.h> - sem_t sem; int sem_init(sem_t *sem, int pshared, unsigned int value); ****编译时后面如**gcc xx.c -o x
阅读全文
摘要:## 标题队列:先进先出 对数据进行分类(存储的时候分类) 操作: 1. 创建或者获取消息队列 1. 写入或者读取数据 2. 删除消息队列 ## 标题创建或者获取消息队列:#include <sys/types.h>#include <sys/ipc.h>#include <sys/msg.h>in
阅读全文
摘要:**tonly.c** ```c#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.
阅读全文
摘要:xx.c ```c#include <stdio.h>#include <sys/types.h>#include <sys/ipc.h>#include <stdlib.h>#include <sys/shm.h>#include <unistd.h>#include <sys/sem.h>int
阅读全文
摘要:ls.c ```c#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#incl
阅读全文
摘要:点灯代码 本次代码基于野火的代码,使用STM32cubeMX生成,移植野火写的代码,也参考了小蜜蜂笔记(这是很好的入门) 下面是移植的代码 .c文件没有啥,主要是.h文件,一般都宏定义好的 这是.c文件 #include "bsp_led_HAL.h" /** * @brief 自由函数 * @pa
阅读全文
摘要:先了解下面的这几个结构体 以下三个函数可以获取文件/目录的属性信息:#include <unistd.h>#include <sys/types.h>#include <sys/stat.h> int stat(const char *path, struct stat *buf);//如果文件是符
阅读全文
摘要:第一方法: #include <time.h> time_t time(time_t *tloc); 功能:计算从1970年1月1日0时0分0秒 到 此时此刻的秒数 参数:保存秒数的变量地址在这里插入代码片 返回值:成功:返回获取的秒数 失败:-1 ctime() #include<stdio.h>
阅读全文