标签归档:Linux

Linux串口操作

1、所需的头文件 #include <stdio.h> #include <stdlib.h> #include <unistd.h> //unix标准函数 #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> ......阅读全文

发表在 编程开发 | 标签为 , | 留下评论

Linux进程通信——使用消息队列

头文件: #include <sys/ipc.h> #include <sys/msg.h> #include <sys/types.h> 函数: key_t ftok(const char *filename, int proj_id); 通过文件名和项目号获得System V IPC键值(用于创建消息......阅读全文

发表在 编程开发 | 标签为 , | 留下评论

Linux进程通信——使用信号量

头文件: #include <sys/ipc.h> #include <sys/sem.h> #include <sys/types.h> 函数: key_t ftok(const char *filename, int proj_id); 通过文件名和项目号获得System V IPC键值(用于创建消息......阅读全文

发表在 编程开发 | 标签为 , | 留下评论

Linux进程通信——使用共享内存

头文件: #include <sys/ipc.h> #include <sys/shm.h> 函数:shmget 分配共享内存 函数原型: int shmget(key_t key, size_t size, int shmflg); key:键值,当为IPC_PRIVATE时新建一块共享内存;若......阅读全文

发表在 编程开发 | 标签为 , | 留下评论

Linux进程通信——使用信号

函数:signal 设置某一信号对应的动作 头文件: #include <signal.h> 函数原型: void (*signal(int signum, void (*handler) (int))) (int); signal:信号编号 handler:信号处理函数,若该参数不是函数指......阅读全文

发表在 编程开发 | 标签为 , | 留下评论

Linux进程通信——使用有名管道

无名管道只能用于父子进程通信,而有名管道可以用于任意进程间通信。 头文件: #include <sys/types.h> #include <sys/stat.h> 函数: int mkfifo(const char *filename, mode_t mode); 创建有名管道......阅读全文

发表在 编程开发 | 标签为 , | 留下评论

Linux进程通信——使用无名管道

头文件: #include <unistd.h> 函数: int pipe(int fd[2]); 创建无名管道。 fd[2]:管道两个文件描述符,fd[0]代表读端(管道头),fd[1]代表写端(管道尾)。 创建成功返回0,失败返回-1。 创建成功之后可......阅读全文

发表在 编程开发 | 标签为 , | 留下评论

Linux多进程编程

创建进程 所需头文件: #include <unistd.h> #include <sys/types.h> 函数: pid_t fork(); 创建一个子进程,在子进程中返回0,在父进程中返回子进程ID,出错则返回-1。 pid_t vfor(); 创建一个子进程......阅读全文

发表在 编程开发 | 标签为 , | 留下评论

Linux下静态编译win32的GTK程序

首先感谢hangyu网友分享的GTK静态库。 原帖地址:http://forum.ubuntu.org.cn/viewtopic.php?f=162&t=354286 下载地址:http://code.google.com/p/static-gtk2-mingw32/ 先说一下在Windows下编译的方法。 解压......阅读全文

发表在 编程开发 | 标签为 , , | 留下评论

linux下交叉编译windows程序

有时候需要编写在Windows下运行的程序,但是又不想切换到Windows下来编译,于是就想在Linux下来编译Windows下运行的exe文件。 这个需要先安装mingw32交叉编译工具。 ubuntu下使用命令:sudo apt-get install ming......阅读全文

发表在 编程开发 | 标签为 , , | 留下评论