B.1.1 File Operations

The following functions deal with operations on files. The type size_t is the unsigned integral type produced by the sizeof operator.

FILE *fopen(const char *filename, const char *mode)

    "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

FILE *freopen(const char *filename, const char *mode, FILE *stream)

int fflush(FILE *stream)

int fclose(FILE *stream)

int remove(const char *filename)

int rename(const char *oldname, const char *newname)

FILE *tmpfile(void)

char *tmpnam(char s[L_tmpnam])

int setvbuf(FILE *stream, char *buf, int mode, size_t size)

void setbuf(FILE *stream, char *buf)

TCPL/B.01.1_File_Operations (2008-02-23 15:35:18由localhost编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.