Linux 文件 open,creat,write,read (C)
来源:互联网 发布:sql 有事物的存储过程 编辑:程序博客网 时间:2024/05/24 08:33
#include <stdio.h>#include<fcntl.h> //file control#include<unistd.h>//unix std ,read ,write,getpid#include<stdlib.h>int main(void){ int createResult; char * filepath="xx.txt"; int file_fd; char buffer[1024]="this is content ,I Writed!"; printf("Hello World!\n"); createResult=creat(filepath,O_CREAT); if(createResult==-1) { printf("create failure!\n"); }else{ printf("create success!\n"); } file_fd=open(filepath,O_WRONLY); if(file_fd==-1) { printf("open failure!\n"); exit(1); } int haswritted=write(file_fd,buffer,sizeof(buffer)); printf("write %dstring in file \n",haswritted); close(file_fd); //////// file_fd=open(filepath,O_RDONLY); read(file_fd,buffer,sizeof(buffer)); printf("%s\n",buffer); close(file_fd); return 0;}
0 0
- Linux 文件 open,creat,write,read (C)
- Linux C read、write、creat、open等函数应用实例
- Linux&C open creat read write lseek 函数用法总结
- linux 基本文件操作-----creat open write read close
- Linux文件I/O(creat/open/read/write/lseek/close/dup/sync)
- C程序设计语言- UNIX系统接口-7.1----文件描述符、低级IO(read、write)、随机访问、(open、creat、close、unlink)
- 【UNIX环境高级编程】文件 IO 操作 一 ( open | close | creat | lseek | write | read )
- UNIX--文件I/O函数--open、creat、close、lseek、read、write等各种函数 详解
- C语言open,read,write函数,及文件读写
- C语言open,read,write函数,及文件读写
- Linux的C函数open()、read()和write()使用说明
- Linux的C函数open()、read()和write()使用说明
- Linux基础编程-文件操作open,lseek,read,write,close
- Linux基础编程-文件操作open,lseek,read,write,close
- Linux文件操作函数open close read write等示例
- linux文件I/O编程 (open、read、write、lseek、close)
- Linux文件结构FILE,与普通open,read,write对比
- Linux 文件IO函数(open/close/read/write/lseek)
- BM系列之 SVN
- IDEA注册码激活
- 【最短路径】洛谷 P1529 回家 Bessie Come Home
- 史上最详细的iOS之事件的传递和响应机制-原理篇
- 12——字符串反转
- Linux 文件 open,creat,write,read (C)
- 相似性度量(Similarity Measurement)
- 【模拟】洛谷 P1534 不高兴的津津(升级版)
- WebLogic集群的启动
- No MyBatis mapper was found in 'XXX' package. Please check your configuration
- PHP 跨域配置
- Linux中忘记mysql的root密码
- 热茶博客项目之--初心、想法及实施计划
- 微信小程序入门八头像上传