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);

  • 相关阅读:
    对于git的认识
    第一篇博客
    结对编程
    对git的认识
    李叔同先生的《梦》
    51nod 1449 砝码称重
    LeetCode 21-29题解
    LeetCode 11-20题解
    LeetCode 6-10 题解
    LeetCode刷题重启博客
  • 原文地址:https://www.cnblogs.com/huang-y-x/p/10296954.html
Copyright © 2011-2022 走看看