zoukankan      html  css  js  c++  java
  • 系统IO

    系统IO:Linux系统提供给应用程序操作文件的接口

    Everything is a file  ,in  Unix

    在Unix/Linux下,万物皆文件

    打开文件函数原型:

    #include<sys/types.h>

    #include<sys/stat.h>

    #include<fcntl.h>

    int open(const char *path, int flag);

    int open(const char *path, int flag, mode_t mode);

    读函数原型:

    #include<unistd.h>

    size_t read(int fd, void* buf, size_t count);

    写函数原型:

    size_t write(int fd, void *buf, size_t count);

    定位文件函数:

    off_t lseek(int fd, off_t offset, int whence);

    关闭函数:

    int close(int fd);

    文件映射函数:

    #include<sys/mman.h>

    void* mmap(void* addr, size_t length, int prot, int flag, int fd, off_t offset );

    关闭文件映射函数:

    int munmap(void* add, size_t length);

  • 相关阅读:
    5/14 补沙
    5/21 购填缝剂
    5/30 购水不漏
    6/1 购防水
    6/4 补防水
    5/21 人工
    5/7 增购电线
    6/2 补防水
    5/4 瓦工进场
    5/31 补瓷砖
  • 原文地址:https://www.cnblogs.com/huang-y-x/p/10296954.html
Copyright © 2011-2022 走看看