unlink的使用
来源:互联网 发布:淘宝美工字体库百度云 编辑:程序博客网 时间:2024/06/05 11:53
#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <errno.h>/*使用unlink删除一个临时文件,先打开一个文件,当关闭文件时自动删除*/int main(int argc,char* argv[]){int fd;//打开一个文件fd = open("tmpfile",O_CREAT|O_RDWR,0644);if(fd == -1){perror("open");exit(1);}//删除临时文件int ret = unlink("tmpfile");if(ret == -1){perror("unlink");exit(1);}//写文件write(fd,"hello\n",6);//重置文件指针lseek(fd,0,SEEK_SET);//读文件char buf[24] = {0};int len = read(fd,buf,sizeof(buf));write(1,buf,len);close(fd);return 0;}
阅读全文
0 0
- unlink的使用
- linux下unlink的使用
- linux下unlink函数的使用
- unlink使用的时候需要注意的问题。
- unlink的特性
- unlink的函数详解
- unlink
- unlink
- unlink()
- unlink();
- unlink()
- PHP 删除文件与文件夹操作 unlink()与rmdir()这两个函数的使用
- Linux (x86) Exploit 开发系列教程之九 使用 unlink 的堆溢出
- linux unlink() access() mkfifo()使用实例
- unlink自己的另一个硬连接 出错
- 通过unlink创建安全的临时文件
- PHP unlink删除本地中文名称的文件
- close与unlink的关系与区别
- 异常
- Java学习第十天
- CNN中参数计算公式
- 整理对Spark SQL的理解
- RHCE——管理Linux网络
- unlink的使用
- B. Fox And Two Dots
- ssm 之 Struts 基础
- 背包问题
- ccf认证工资计算
- MySQL收回权限
- linux文件上传下载
- 方法重载和方法重写
- 简单的投票软件