Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ungetc(3) — OSF/1 X2.0-8 MIPS

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fseek(3)

getc(3)

getwc(3)

setbuf(3)

ungetc(3)  —  Subroutines

OSF

NAME

ungetc, ungetwc − Pushes a character back into input stream

LIBRARY

Standard I/O Package (libc.a)

SYNOPSIS

#include <stdio.h>

int ungetc (
int character,
FILE ∗stream );

PARAMETERS

character
Specifies a character.

stream
Specifies the input stream.

DESCRIPTION

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

If the character parameter is EOF, the ungetc() function does not place anything in the buffer and a value of EOF is returned. 

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

The ungetc() function returns a value of EOF if it cannot insert the character. 

NOTES

When running with Japanese Language Support, the following function, stored in libc.a, is provided:

#include <stdio.h> int ungetwc (
int character,
FILE ∗stream );

The ungetwc() function inserts the NLchar specified by the character parameter into the buffer associated with the input stream. This causes the next call to the getwc() function to return the value of the character parameter. 

AES Support Level: Full use

RETURN VALUES

The ungetwc() function returns a value of EOF if the character cannot be inserted. 

RELATED INFORMATION

Functions: fseek(3), getc(3), getwc(3), setbuf(3)

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