Index of Section 3 Manual Pages

Interix / SUAfgetc.3Interix / SUA

fgetc(3)                                                       fgetc(3)

  getc()

  NAME

    fgetc(), getc(), getchar() - get next character or word from input stream

  SYNOPSIS

    #include 

    int fgetc (FILE *stream)
    int getc (FILE *stream)
    int getchar(void)

  DESCRIPTION

    The fgetc(3) function obtains the next input character (if present) from
    the stream pointed at by stream, or the next character pushed back on the
    stream through ungetc(3).

    The getc(3) function acts essentially identically to fgetc(3), but is a
    macro that expands in-line.

    The getchar(3) function is equivalent to:

    getc(stdin)

    Once end-of-file is reached, the end-of-file condition is remembered, even
    on a terminal, and all subsequent attempts to read will return EOF until
    the condition is cleared with clearerr(3).

  RETURN VALUES

    If successful, these routines return the next requested object from the
    stream. If the stream is at end-of-file or a read error occurs, the
    routines return EOF. Since EOF is a valid integer value, you must use
    feof(3) and ferror(3) to distinguish between end-of-file and error. If an
    error occurs, the global variable errno is set to indicate the error.

  ERRORS

    These functions can set errno to the following values:

    [EBADF]
        Stream is not a valid file descriptor open for reading.

    [EIO]
        An I/O error occurred while reading from the file system.

    [EINTR]
        A read from a slow device was interrupted before any data arrived by
        the delivery of a signal.

    [EINVAL]
        The pointer associated with stream was negative.

    [EAGAIN]
        The file was marked for non-blocking I/O, and no data were ready to be
        read.

  SEE ALSO

    ferror(3)

    fread(3)

    fopen(3)

    putc(3)

    ungetc(3)

  USAGE NOTES

    All of these functions are thread safe.

    None of these functions are async-signal safe.


Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA