Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ungetc(3) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fseek, rewind, ftell

getc, fgetc, getchar, getw

setbuf, setvbuf

standard i/o

library

ungetc

Purpose

     Pushes a character back into input stream.

Library

     Standard I/O Library (libc.a)

Syntax

     #include <stdio.h>

     int ungetc (c, stream)
     int c;
     FILE *stream;

Description

     The ungetc subroutine inserts  the character specified by
     the c parameter into the buffer associated with the input
     stream specified  by the  stream parameter.   This causes
     the next call to the getc subroutine to return c.  ungetc
     returns c, and leaves the stream file unchanged.

     If the  c parameter  is EOF,  then the  ungetc subroutine
     does not place anything in the  buffer and a value of EOF
     is returned.

     You can  always push  one character  back onto  a stream,
     provided that something has been  read from the stream or
     setbuf has been called.   The fseek subroutine erases all
     memory of inserted characters.

     The ungetc subroutine returns EOF if it cannot insert the
     character.

Related Information

     In  this book:   "fseek, rewind,  ftell,"  "getc,  fgetc,
     getchar,  getw,"  "setbuf,  setvbuf,"  and "standard  i/o
     library."

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026