##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# ungetc

From cppreference.com
< c‎ | io

Defined in header `<stdio.h>` |  |
int ungetc( int ch, FILE *stream ); |  |

Puts the character `ch` back to the given file stream.

### [edit] Parameters

ch | - | character to be put back
stream | - | file stream to put the character back to

### [edit] Return value

On success `ch` is returned.

On failure EOF is returned and the given stream remains unchanged.

### [edit] See also

fgetc getc | gets a character from a file stream (function) [edit]
C++ documentation for ungetc

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/io/ungetc&oldid=56483"