关于系统调用的open的应用举例
来源:互联网 发布:进化算法和遗传算法 编辑:程序博客网 时间:2024/04/27 02:14
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <unistd.h>
#include<stdio.h>
#include <string.h>
#define SIZE 1024
int main()
{
int fd =open ("abc",O_RDWR|O_CREAT,0777);
if (fd==-1)
{
perror("open fd");
return -1;
}
lseek(fd ,20,SEEK_SET);
char *buf="hello";
write (fd,buf ,strlen(buf));
close (fd);
return 0;
}
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <unistd.h>
#include<stdio.h>
#include <string.h>
#define SIZE 1024
int main()
{
int fd =open ("abc",O_RDWR|O_CREAT,0777);
if (fd==-1)
{
perror("open fd");
return -1;
}
lseek(fd ,20,SEEK_SET);
char *buf="hello";
write (fd,buf ,strlen(buf));
close (fd);
return 0;
}
阅读全文
0 0
- 关于系统调用的open的应用举例
- 调用函数的应用举例
- open系统调用的源码
- 应用层open如何调用驱动open函数的?
- 彻底的系统调用---open函数
- 彻底的系统调用---open函数
- 系统调用1--open函数的使用
- 系统调用open的大概执行路径
- open系统调用的O_CREAT和O_EXCL
- Visual Basic调用Windows API函数的应用举例
- enum 枚举类型定义常量及调用的应用举例
- 关于系统调用open,write,read,close及库函数fopen,fwrite,fread,fclose的使用
- 定时器的应用举例
- StringBuffer的应用举例
- 栈的应用举例
- 队列的应用举例
- 查表法的应用举例
- 单链表的应用举例
- 面试题:介绍JS基础数据类型
- 1020. Tree Traversals (25)
- GCC编译ARM篇
- Python-队列
- UWP 如何访问本地代理
- 关于系统调用的open的应用举例
- Android面试--2017最新
- 【深度学习看手相】台湾学生获奖 AI 项目是科学还是伪科学? 搜狐科技 08-06 12:44 1新智元报道 来源: medium,facebook 编译:胡祥杰 张易 【新智元导读】本周日带来一个有
- java switch case 中使用String
- 如何让用户在点击"提交(submit)"按钮提交数据前保证所有字段正确输入
- 十进制转化为二进制
- Oracle用户和表空间管理
- Rman 备份脚本全
- maven入门之自动创建目录骨架