Admin Production ni-theme
Current Publication

getc

LabWindows/CVI

getc

int getc (FILE *stream);

Purpose

Reads the next character from the specified input stream and advances the file position indicator. If successful, the function returns the character read; otherwise, the function returns EOF (-1).

Note Note   This function is equivalent to fgetc, except that if implemented as a macro, it may evaluate the stream more than once. Therefore, the argument passed to it should never be an expression with potential side effects.

Parameters

Input
Name Type Description
stream FILE * Contains a pointer to the input stream from which a character is read.

Return Value

Name Type Description
characterRead int Contains the next character read from the input stream pointed to by stream. Two cases cause the function to return EOF (-1):
  • Read error—Error indicator for stream is set
  • Stream at end-of-file—EOF indicator for stream is set

If an error occurs, getc returns EOF and sets errno to a nonzero value.

Additional Information

Library: ANSI C Library

Include file: ansi_c.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later