- 博客(17)
- 资源 (7)
- 收藏
- 关注
原创 Linux -- tcp单向文件传输例程
tcp_send_file.c#include <stdio.h>#include <stdlib.h>#include <sys/types.h> #include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#includ...
2019-08-13 09:20:34 583
原创 Linux -- 信号量编程接口封装及如何实现互斥与同步
sem.h #ifndef _SEM_H#define _SEM_H int get_sem(int key, int nsems); int del_sem(int semid); int set_sem_val(int semid, int semnum, int sem_val); int sem_P(int semid, int semnum); int sem_V(in...
2019-08-12 09:22:58 509
原创 Linux --共享内存单向读写举例(非同步->同步机制)
部分内核的宏: #ifndef _ASM_GENERIC_ERRNO_BASE_H#define _ASM_GENERIC_ERRNO_BASE_H#define EPERM 1 /* Operation not permitted */#define ENOENT 2 /* No such file or directory */#define ESRC...
2019-08-11 16:06:56 564
翻译 Linux -- ftok函数
翻译自Ubuntu 19版本下的Linux Programmer's Manual函数名:ftok – 将一个路径名和一个对象标识符转换为System V IPC键值。概要:#include <sys/types.h> #include <sys/ipc.h> key_t ftok(const char *pathname, int ...
2019-08-10 22:32:05 400
原创 Linux --sigaction举例(改变信号默认操作)
环境 -- ubuntu64位 内核宏及函数部分对照/*signal number*/#define SIGHUP 1#define SIGINT 2#define SIGQUIT 3#define SIGILL 4#define SIGTRAP 5#define SIGABRT 6#define SIGIOT...
2019-08-10 12:48:11 763
原创 Linux -- 有名管道mkfifo单向读写实例
fifo_write.c #include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>#include <string.h>#include <fcntl.h>...
2019-08-08 21:16:08 1173
原创 Linux -- 无名管道pipe单向读写演示实例
#include <sys/types.h>#include <sys/wait.h>#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#define QUIT_STR "quit"intmain(int a...
2019-08-08 19:31:32 383
翻译 Linux -- fflush函数
翻译自Ubuntu 19版本下的Linux Programmer's Manual函数名:fflush - 刷新一个流概要: #include <stdio.h> int fflush(FILE *stream);描述: 对于输出流,fflush()通过流的底层write(2)函数对所有用户空间缓存的数据进行强制写操作,写到所给定的输出或...
2019-08-07 17:21:19 3831
翻译 Linux -- dup, dup2, dup3
翻译自Ubuntu 19版本下的Linux Programmer's Manual函数名:dup, dup2, dup3 - 复制一个文件描述符概要:#include <unistd.h>int dup(int oldfd);int dup2(int oldfd, int newfd);#define _GNU_SOURCE /* 参...
2019-08-07 12:12:32 403
原创 Linux -- ls -l 命令的函数实现
效果:file_mode.h文件#ifndef __FILE_MODE_H#define __FILE_MODE_H void stat_mode(const char *pathname);#endiffile_mode.c文件#include <string.h>#include <sys/types.h>#include <...
2019-08-07 08:38:03 567
翻译 Linux -- asctime, ctime, gmtime, localtime, mktime, asctime_r, ctime_r, gmtime_r, localtime_r函数
函数名:asctime, ctime, gmtime, localtime, mktime, asctime_r, ctime_r, gmtime_r, localtime_r - 转换日期和时间成分解时间(修正时间)或者ASCII格式的字符串。概要: #include <time.h> char *asctime(const struct tm *...
2019-08-06 11:45:28 1790
翻译 Linux -- stat, fstat, lstat, fstatat函数
函数名:stat, fstat, lstat, fstatat - 获取文件的状态概要: #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> int stat(const char *pathname, struct stat *statbuf...
2019-08-05 15:59:49 1624
原创 c语言中的逻辑值
说明: 逻辑值有两种:“真”和“假”。非0为真,否则为假。c语言没有提供逻辑值给用户使用,c++提供了以True表示真,False表示假。条件判断、关系运算符、逻辑表达式的结果都是逻辑值。由于c语言的灵活特性,以1代表逻辑“真”,以0代表逻辑“假”。测试: 由结果可以看到非0代表真,执行了if下的输出语句,说明了条件判断是以逻辑值去判别的。而1逻辑与5的结果为1,-7逻辑与0的...
2019-08-03 20:30:21 8745
翻译 linux gcc命令
gcc: 描述: 当您调用GCC时,它通常执行预处理、编译、汇编和链接。"overall option"选项能够让你停止在这个过程的某一个中间阶段。例如,-c选项表示不运行链接器。然后只输出通过汇编程序汇编后的目标文件。其他选项用在某一个处理阶段。还有一些选项用于控制预处理器和编译器本身。由于您很少需要使用它们中的任何一个,所以这里没有记录其中的大多数。然而,其他选项控制汇编和链接器;...
2019-08-03 17:43:13 322
原创 动态库(.so)的制作
扩展: linux gcc命令描述: a.动态库也叫共享库 b.动态库把对一些库函数的链接载入推迟到程序运行的时期(runtime)。c.可以实现进程之间的资源共享。d.将一些程序升级变得简单。e.甚至可以真正做到链接载入完全由程序员在程序代码中控制。创建动态库:a.将库源文件编译成.o的目标文件–> gcc [-fPIC] -c mylib.c -o mylib....
2019-08-02 08:58:43 1970
原创 linux ar命令 --静态库(.a)的制作
[ar命令] 描述: Linux系统的一个备份打包命令,用于创建归档文件(archive),或从归档文件中提取、添加、删除成员文件。 ar命令最常见的用法是将目标文件(.o)打包为静态链接库(.a)。在嵌入式开发中经常用到。 命令格式: ar p [mod] 归档文件 [成员文件…] p:必选参数,只能选一个 –r:插入成员文件…存档(带替换)。此操作与q...
2019-08-01 22:39:36 2969 1
esp8266按键时钟调整驱动基于安信可编译器
2018-11-29
ESP8266_AT固件源码(update for sdk v0.9.4)
2018-11-03
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人