zoukankan      html  css  js  c++  java
  • fopen与open的不同

    NAME
           open - open a file

    SYNOPSIS
            #include <sys/stat.h>
            #include <fcntl.h>
            int open(const char *path, int oflag, ...  );
    DESCRIPTION
           The  open() function shall establish the connection between a file and a file descriptor. It shall  create  an  open  file  description  that refers  to  a file and a file descriptor that refers to that open file description. The file descriptor is used by  other  I/O  functions  to refer  to that file. The path argument points to a pathname naming the file.

    FILE *fopen(const char *filename, const char *mode)
    fopen opens the named file, and returns a stream, or NULL if the attempt fails. Legal values for mode include:

        "r" open text file for reading 
        "w" create text file for writing; discard previous contents if any 
        "a" append; open or create text file for writing at end of file 
        "r+" open text file for update (i.e., reading and writing) 
        "w+" create text file for update, discard previous contents if any 
        "a+" append; open or create text file for update, writing at end  
        Update mode permits reading and writing the same file; fflush or a file-positioning function must be called between a read and a write or vice versa. If the mode includes b after the initial letter, as in "rb" or "w+b", that indicates a binary file. Filenames are limited to FILENAME_MAX characters. At most FOPEN_MAX files may be open at once.


    范晨鹏
    ------------------
    软件是一种态度
    成功是一种习惯


  • 相关阅读:
    模板复习
    [BZOJ4016][FJOI2014]最短路径树问题(dijkstra+点分治)
    Stirling数,Bell数,Catalan数,Bernoulli数
    [BZOJ2820]YY的GCD
    [BZOJ2154]Crash的数字表格
    [HAOI2011]Problem b&&[POI2007]Zap
    [BZOJ2588][SPOJ10628]Count on a tree
    [ONTAK2010]Peaks
    [HNOI2010]弹飞绵羊
    [HNOI2004]宠物收养所
  • 原文地址:https://www.cnblogs.com/diylab/p/1146205.html
Copyright © 2011-2022 走看看