设置和影响套接口选项的方法有 1.getsockopt和setsockopt 2.fcntl 3.ioctl getsockopt和setsockopt 这两个方法仅适用于套接字 有两种基本类型的套接口选项:打开或关闭某个特性的二进制标志,取得并返回我们可以设置或检验的特定值的选项,标有标志的列指明 ...
分类:
其他好文 时间:
2016-07-11 18:58:26
阅读次数:
456
close(关闭文件)
相关函数 open,fcntl,shutdown,unlink,fclose
表头文件 #include
定义函数 int close(int fd);
函数说明 当使用完文件后若已不再需要则可使用close()关闭该文件,二close()会让数据写回磁盘,并释放该文件所占用的资源。参数fd为先前由open()或creat()所返回的文件描述词。...
分类:
其他好文 时间:
2016-07-09 09:21:56
阅读次数:
222
实现了 增删改查 创建了一个结构体 保存 num name cout price 代码 #include<stdio.h>#include<string.h>#include<fcntl.h>#include<sys/mman.h> typedef struct{ int num; char nam ...
分类:
其他好文 时间:
2016-07-08 21:54:40
阅读次数:
240
嵌入式Linux系统编程(二)——文件描述符控制函数fcntl由于fcntl函数实在过于灵活和复杂,本文将fcntl函数从文件IO中单独列出来,便于详细解读。函数原型如下:#include<unistd.h>#include<fcntl.h>intfcntl(intfd,intcmd,.../*arg*/);fcntl函数用于控制操作文件..
分类:
系统相关 时间:
2016-07-06 18:48:41
阅读次数:
230
异步通知,主要说的是使用信号的方式,同时使用信号也是实现进程之间通信的一种方式。 多的不说,我们直接看代码: 首先应用程序的: #include <sys/types.h> #include <unistd.h> #include <fcntl.h> /* fifthdrvtest */ int f ...
分类:
系统相关 时间:
2016-07-03 13:03:18
阅读次数:
231
最近学习了管道 pipe,在这里进行一下总结。 这里贴一段自己的实做代码 pipe作为linux进程通讯中的一种常用手段被广泛使用,函数原型为int pipe(int filedes[2]); 其中filedes中的filedes[0]代表读 filedes[1]代表写。 再不使用fcntl函数限定 ...
分类:
系统相关 时间:
2016-07-01 10:18:51
阅读次数:
174
int open(const char *pathname, int flags, mode_t mode); #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> 参数1:要打开的文件 参数2:打开类型,O_RDONLY,O ...
分类:
系统相关 时间:
2016-06-29 23:31:49
阅读次数:
247
#include<stdio.h>
#define_GNU_SOURC
#include<fcntl.h>
#include<stdlib.h>
#include<signal.h>
#include<unistd.h>
staticvoidhandler_d(intsig,siginfo_t*s,void*data)
{
inteven_fd,even_pid;
even_fd=s->si_fd;
even_pid=s->si_p..
分类:
其他好文 时间:
2016-06-27 17:53:41
阅读次数:
182
最近在看APUE,看到3.14节,fcntl的时候#include <fcntl.h>int fcntl(int fd, int cmd, .../* int arg */);出错返回-1,具体返回值依赖于cmd参数。其中提到一个CMD,FD_GETFD FD_SETFD所返回的文件描述符标志FD_ ...
分类:
系统相关 时间:
2016-06-25 19:09:54
阅读次数:
316
1.access函数 功能描述:检查调用进程是否可以对指定的文件执行某种操作. 用法: #include <unistd.h> #include <fcntl.h>int access(const char *pathname, int mode); 参数: pathname: 需要测试的文件路径名 ...
分类:
数据库 时间:
2016-06-15 01:44:29
阅读次数:
356