LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

getchar

getchar

int getchar (void);

Purpose

Returns the next character from the input stream pointed to by the standard input. If the stream is at end-of-file or a read error occurs, the end-of-file indicator for the stream is set and the function returns EOF (-1).

Note Note  This function is equivalent to getc(stdin).

Parameters

None.

Return Value

Name Type Description
characterRead int Contains the next character from the input stream pointed to by stdin. 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, getchar 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

Example

Refer to userint\standardio.cws for an example of using the getchar function.

Was this information helpful?