zoukankan      html  css  js  c++  java
  • Linux学习之路4——文件IO打开、创建、读写操作

    1、使用man 2 open、man 2 creat、man 2 write、man 2 read命令获取头文件

      语法:

    int open(const char *pathname, int flags);//pathname:路径名,flags:O_RDONLY 只读,O_WRONLY 只写,O_RDWR 可读可写,O_NOCTTY如果路径指向终端,则不将设备作为此进程的控制终端 ,O_NDELAY非阻塞 。错误返回-1
    int open(const char *pathname, int flags, mode_t mode);//mode:文件权限。错误返回-1 int creat(const char *pathname, mode_t mode);//参数含义同上。错误返回-1

        ssize_t read(int fd, void *buf, size_t count);//fd:句柄,*buf:读出的数据缓存,最多读的字节数。错误返回-1,正确返回读取字节数

        ssize_t write(int fd, const void *buf, size_t count);//fd:句柄,*buf:要写入的数据,count,要写入的最大字节数。错误返回-1,正确返回写入字节数

    2、拷贝到Ubuntu中,在Ubuntu中编译

    3、编译文件拷贝到U盘中

    4、烧写流程参考上一篇文章

  • 相关阅读:
    Leetcode 127 **
    Leetcode 145
    Leetcode 144
    Leetcode 137
    Leetcode 136
    重写nyoj2——括号匹配
    堆排序
    Leetcode 150
    【转】个人最常用的Eclipse快捷键
    Ajax编程中,经常要能动态的改变界面元素的样式
  • 原文地址:https://www.cnblogs.com/syj888/p/10583744.html
Copyright © 2011-2022 走看看