Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ungetwc(3) — OSF/1 3.0 αXP

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fseek(3)

getc(3)

getwc(3)

setbuf(3)

ungetc(3)  —  Subroutines

NAME

ungetc, ungetwc − Pushes a character back into the input stream

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <stdio.h>

int ungetc(
        int c,
        FILE ∗stream);

#include <wchar.h>

wint_t ungetwc(
        wint_t wchar,
        FILE ∗stream);

PARAMETERS

cSpecifies a byte to be inserted into the input stream. 

streamSpecifies the input stream. 

wcharSpecifies a wide-character code. 

DESCRIPTION

The ungetc() function converts the byte specified by the c parameter into an unsigned char and inserts it into the buffer associated with the input stream specified by the stream parameter. This causes the next call to the getc() function to return c. 

If the c parameter has a value equal to EOF, the ungetc() function does not place anything in the buffer and the input stream is unchanged. 

You can always push one byte back onto a stream.  The fseek() subroutine erases all memory of inserted characters. 

The ungetwc() function inserts the character corresponding to the wide character code specified by wchar into the buffer associated with the input stream. The character may consist of one or more bytes.  This causes the next call to the getwc() function to return the value of the wchar parameter. 

If the ungetwc() wchar parameter is WEOF, the ungetwc() function does not place anything in the buffer and the input stream is unchanged. 

The ungetc() and ungetwc() functions do not have any effect on the external storage corresponding to the stream. 

NOTES

AES Support Level:
Full use (ungetc()). 

RETURN VALUES

The ungetc() returns c if it succeeds in inserting the byte in the stream. Otherwise, it returns a value of EOF. 

The ungetwc() function returns a value of wchar if the operation of inserting the character in the stream is successful. Otherwise, the function returns a value of WEOF. 

ERRORS

If the following condition occurs, the ungetwc() function sets errno to the corresponding value. 

[EILSEQ]Indicates that the wide-character code does not correspond to a valid character. 

RELATED INFORMATION

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

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