阻塞与非阻塞指的是 socket api,如,accept,read,write,conncet等,通过fcntl或者ioctlsockt可以设置socket非阻塞。 同步与异步指的是 io复用通知应用程序的是 io就绪事件还是io完成事件,也就是读写数据是有应用程序来读写还是内核来读写。也叫rea ...
分类:
其他好文 时间:
2017-11-18 23:36:20
阅读次数:
141
//这是在上一个实例的基础上用strcat函数解决了回车换行的问题
#include<fcntl.h>
#include<stdio.h>
#include<string.h>
intmain(intargc,char*argv[])
{
intfd;//文件描述符
inttemp;//临时变量
charwritebuf[30];//用于存放写入字符串
charendbuf[]="\n";..
分类:
系统相关 时间:
2017-11-18 16:36:10
阅读次数:
189
//使用gets函数从标准输入(键盘)获得一个以回车换行为结束的字符串,可以带空格
//运行时候屏幕会提示输入字符处,以回车结尾
//需要注意的是待输入的字符串存放在writebuf中,不能超过30字节并且不会带回车换行
#include<fcntl.h>
#include<stdio.h>
#include&l..
分类:
系统相关 时间:
2017-11-18 16:36:04
阅读次数:
236
Fileio 1.open() 系统调用 头文件 #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> 原型 int open(const char * name,int flags); int open(const char ...
分类:
系统相关 时间:
2017-11-16 15:20:13
阅读次数:
239
#include<sys/types.h> #include<sys/stat.h> #include<errno.h> #include<string.h> #include<stdio.h> #include<unistd.h> #include<fcntl.h> int main (void) ...
分类:
其他好文 时间:
2017-10-20 20:12:19
阅读次数:
226
功能描述:根据文件描述词来操作文件的特性。 文件控制函数 fcntl -- file control头文件: #include <unistd.h> #include <fcntl.h> 函数原型: int fcntl(int fd, int cmd); int fcntl(int fd, int ...
分类:
系统相关 时间:
2017-10-14 19:57:28
阅读次数:
263
其中一部分从伯乐在线和网络上摘抄的内容,不用于商业用途。 一、linux系统将设备分为3类:字符设备、块设备、网络设备。 字符设备:是指只能一个字节一个字节读写的设备,不能随机读取设备内存中的某一数据,读取数据需要按照先后数据。字符设备是面向流的设备,常见的字符设备有鼠标、键盘、串口、控制台和LED ...
分类:
系统相关 时间:
2017-09-27 20:44:18
阅读次数:
279
本文转载自:http://blog.chinaunix.net/uid-16785183-id-3040310.html 分类: 原文地址:应用程序 /dev/rtc 编程 获取时间 作者:yuweixian4230 分类: 原文地址:应用程序 /dev/rtc 编程 获取时间 作者:yuweixi ...
分类:
其他好文 时间:
2017-09-23 12:24:05
阅读次数:
132
1.通过c直接实现 #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> int fileNum=0; ch ...
分类:
系统相关 时间:
2017-09-03 00:21:26
阅读次数:
253
最近遇到一个mmap的问题,然后为了测试该问题,写了如下测试代码: #include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unis ...
分类:
其他好文 时间:
2017-08-24 21:36:00
阅读次数:
199