stdio.h

    IO

    Description:

    Declares common functions used for performing input and output (I/O) operations.

    You can use the functions provided in this file to perform the I/O operations required during development. Distinguished by I/O targets, there are standard I/O, file stream I/O, and string I/O.

    Since:

    1.0

    Version:

    1.0

    Function Name

    Description

    (const char __restrict path, const char restrict mode)

    FILE  

    Opens the file stored in the specified path based on the given mode.

    (FILE fd)

    int 

    Closes a file based on the specified file descriptor.

    (const char pathname)

    int 

    Deletes a specified file or directory from the file system.

    rename (const char oldpath, const char newpath)

    int 

    Renames a specified file.

    (FILE fp)

    int 

    Tests the end-of-file indicator for a specified stream.

    (FILE stream)

    int 

    Tests for the error identifier of a specified file stream.

    (FILE fp)

    int 

    Flushes the output buffer of a specified stream.

    (FILE fp)

    void 

    Resets the error indicators.

    (FILE fp, long offset, int whence)

    int 

    Changes the position of a specified stream to a new position.

    (FILE fp)

    long 

    Obtains the current value of the file position indicator for a specified file stream.

    (FILE stream)

    void 

    Sets the position indicator of a specified stream to the beginning of the file.

    (FILE stream, fpos_t pos)

    int 

    Obtains the current file position of a specified stream and writes it to the pos parameter.

    (FILE fp, const fpos_t pos)

    int 

    Sets the file position indicator for a specified file stream.

    (void *restrict ptr, size_t size, size_t nmemb, FILE __restrict stream)

    size_t 

    Reads data from a specified stream.

    (const void restrict ptr, size_t size, size_t nmemb, FILE *restrict stream)

    size_t 

    Writes data to a specified stream.

    (FILE stream)

    int 

    Reads a character from a specified file stream.

    (void)

    int 

    Obtains the next character from the standard input (stdin).

    ungetc (int c, stream)

    int 

    Pushes a character back into a specified file stream.

    fputc (int c, stream)

    int 

    Writes a character into the position pointed to by a specified stream.

    putc (int c, stream)

    Writes a character to a specified file stream.

    putchar (int c)

    int 

    Writes a character into the standard output (stdout).

    (char s, int size, FILE stream)

    char  

    Reads a line of characters from a specified file stream and stores it into the string pointed to by s.

    (char s)

    char  

    Reads a line of characters from the stdin and stores it in the buffer.

    fputs (const char s, stream)

    int 

    Writes a character string (excluding the terminating null character) to a specified file stream.

    puts (const char s)

    int 

    Writes a character string and appends a new-line character to the stdout.

    (const char format,…)

    int 

    Formats arguments based on format and prints formatted data to the stdout.

    fprintf ( stream, const char format,…)

    int 

    Formats arguments based on format and prints formatted data to a specified file stream.

    sprintf (char str, const char format,…)

    int 

    Prints formatted data from a variable argument list to a specified string.

    (char str, size_t size, const char format,…)

    int 

    Prints formatted data of a maximum of size bytes from a variable argument list to a specified string.

    vprintf (const char format, va_list ap)

    int 

    Prints formatted data from a variable argument list to the stdout.

    (FILE stream, const char format, va_list ap)

    int 

    Prints formatted data from a variable argument list to a specified file stream.

    (char str, const char format, va_list ap)

    int 

    Prints formatted data from a variable argument list to a specified string.

    vsnprintf (char str, size_t size, const char format, va_list ap)

    int 

    Prints formatted data of a maximum of size bytes from a variable argument list to a specified string.

    (const char format,…)

    int 

    Reads formatted data from the stdin and stores the data to the additional arguments based on format.

    fscanf ( stream, const char format,…)

    int 

    Reads formatted data from a specified file stream and stores it based on format into the locations pointed to by the variable arguments.

    sscanf (const char str, const char format,…)

    int 

    Reads data from a character string pointed to by str and stores it based on format into the locations pointed to by the variable arguments.

    (const char format, va_list ap)

    int 

    Reads data from the stdin and stores it based on format into the locations pointed to by the elements in the variable argument list identified by ap.

    vfscanf ( stream, const char format, va_list ap)

    int 

    Reads data from a specified file stream and stores it based on format into the locations pointed to by the elements in the variable argument list identified by ap.

    vsscanf (const char str, const char format, va_list ap)

    int 

    Reads data from a specified string and stores it based on format into the locations pointed to by the elements in the variable argument list identified by ap.

    (const char msg)

    void 

    Prints the last error occurred during a call to a system or library function to the standard error output stream (stderr).

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

    int 

    Sets the mode and size of the buffer for a specified stream.

    setbuf ( stream, char buf)

    void 

    Sets a buffer to be used by a specified stream.

    fmemopen (void buf, size_t size, const char mode)

     

    Opens a memory stream that allows the access mode specified by mode.

    open_memstream (char ptr, size_t size)

     

    Opens a stream for writing to a specified buffer.

    pclose ( f)

    int 

    fileno ( fp)

    int 

    Obtains the file descriptor of a specified file stream.

    fseeko ( fp, off_t offset, int whence)

    int 

    Sets the position of the next input or output operation on a specified file stream.

    ftello ( fp)

    off_t 

    Obtains the current value of the file position indicator for a specified file stream.

    dprintf (int fd, const char format,…)

    int 

    Prints formatted data to a specified file.

    (int fd, const char format, va_list ap)

    int 

    Prints formatted data from a variable argument list to a specified file.

    ftrylockfile ( filehandle)

    int 

    Locks a specified file.

    funlockfile ( filehandle)

    void 

    Unlocks a specified file.

    getc_unlocked ( stream)

    int 

    Obtains a character from a specified file stream without locking the file stream or checking whether it is locked.

    getchar_unlocked (void)

    int 

    Obtains the next character from stdin.

    (int c, FILE stream)

    int 

    Writes a character to a specified file stream with the thread remains unlocked.

    (int c)

    int 

    Writes a character to the stdout with the thread remains unlocked.

    getdelim (char lineptr, size_t n, int delim, stream)

    ssize_t 

    Reads an entire line from a specified file stream.

    getline (char lineptr, size_t n, stream)

    ssize_t 

    Reads an entire line from a specified file stream.

    tempnam (const char dir, const char prefix)

    char  

    Creates a temporary file with a unique file name.

    (FILE f, char buf, size_t size)

    void 

    Sets the buffer for a specified file stream.

    (FILE f)

    void 

    Sets the linear buffer for a specified file stream.

    (FILE stream)

    int 

    Reads a character from the file pointed to by stream.

    (FILE stream)

    int 

    Reads a character from the file pointed to by stream with the thread remains unlocked.

    (int c, FILE stream)

    int 

    Writes a character to the file stream pointed to by stream at the current position.

    (FILE stream)

    int 

    Tests for the error identifier of a specified file stream.

    (FILE stream)

    int 

    Reads a word (an int value) from a specified file stream.

    (int w, FILE stream)

    int 

    Writes a word (an int value) to a specified file stream.

    (FILE stream, size_t len)

    char * 

    Reads a line of data from the current position of a specified file stream.

    (char strp, const char fmt,…)

    int 

    Prints formatted data to a specified character string.

    vasprintf (char **strp, const char fmt, va_list ap)

    int 

    Prints formatted data from a variable argument list to a specified character string.