![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
unix高级环境编程
nuoshueihe
这个作者很懒,什么都没留下…
展开
-
C语言文件读写操作中缓冲区问题和setbuf函数详解
清除和设置文件缓冲区 (1).清除文件缓冲区函数: int fflush(FILE *stream); int flushall(); fflush()函数将清除由stream指向的文件缓冲区里的内容,常用于写完一些数据后,立即用该函数清除缓冲区,以免误操作时,破坏原来的数据。 flushall()将清除所有打开文件所对应的文件缓冲区。 (2).设置文件缓冲区函数 void setbuf(FIL转载 2012-11-20 09:53:09 · 7938 阅读 · 2 评论 -
linux进程间通信--信号量
信号量: 解决进程之间的同步与互斥的IPC机制 多个进程同时运行,之间存在关联 •同步关系 •互斥关系 互斥与同步关系存在的根源在于临界资源 •临界资源是在同一个时刻只允许有限个(通常只有一个)进程可以访问(读)或修改(写)的资源 –硬件资源(处理器、内存、存储器以及其他外围设备等) –软件资源(共享代码段,共享结构和变量等) •临界区转载 2012-11-20 17:53:24 · 389 阅读 · 0 评论 -
利用消息队列来设置IPC
本程序的功能是利用系统V(Sys V)消息队列来实现进程间的通信(IPC). 简单地介绍程序: 用到的一个数据结构-------消息,用一个结构体来表示: struct msgbuf { long mtype; // 消息的类型 char mtext[ 1 ]; // 消息的内容,并不是表示只存一个字符 } ; 几个AP转载 2012-11-20 16:47:53 · 521 阅读 · 0 评论 -
select 详解
select系统调用是用来让我们的程序监视多个文件描述符(file descriptor)的状态变化的。程序会停在select这里等待,直到被监视的文件描述符有某一个或多个发生了状态改变。 select函数原型如下: int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timev转载 2012-12-07 10:51:07 · 451 阅读 · 0 评论 -
Handle multiple socket connections with fd_set and select on Linux
When writing server programs using sockets , it becomes necessary to handle multiple connections at a time , since a server needs to serve multiple clients. There are many ways to do so. On linux t转载 2012-12-07 15:23:49 · 1048 阅读 · 0 评论 -
fcntl系统调用
功能描述:根据文件描述词来操作文件的特性。 用法: int fcntl(int fd, int cmd); int fcntl(int fd, int cmd, long arg); int fcntl(int fd, int cmd, struct flock *lock); 参数: fd:文件描述词。 cmd:操作命令。 arg:转载 2013-04-07 10:07:24 · 600 阅读 · 0 评论