Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ungetwc(3c) [opensolaris man page]

ungetwc(3C)						   Standard C Library Functions 					       ungetwc(3C)

NAME
ungetwc - push wide-character code back into input stream SYNOPSIS
#include <stdio.h> #include <wchar.h> wint_t ungetwc(wint_t wc, FILE *stream); DESCRIPTION
The ungetwc() function pushes the character corresponding to the wide character code specified by wc back onto the input stream pointed to by stream. The pushed-back characters will be returned by subsequent reads on that stream in the reverse order of their pushing. A success- ful intervening call (with the stream pointed to by stream) to a file-positioning function ( fseek(3C), fsetpos(3C) or rewind(3C)) discards any pushed-back characters for the stream. The external storage corresponding to the stream is unchanged. One character of push-back is guaranteed. If ungetwc() is called too many times on the same stream without an intervening read or file- positioning operation on that stream, the operation may fail. If the value of wc equals that of the macro WEOF, the operation fails and the input stream is unchanged. A successful call to ungetwc() clears the end-of-file indicator for the stream. The value of the file-position indicator for the stream after reading or discarding all pushed-back characters will be the same as it was before the characters were pushed back. The file-position indicator is decremented (by one or more) by each successful call to ungetwc(); if its value was 0 before a call, its value is indetermi- nate after the call. RETURN VALUES
Upon successful completion, ungetwc() returns the wide-character code corresponding to the pushed-back character. Otherwise it returns WEOF. ERRORS
The ungetwc() function may fail if: EILSEQ An invalid character sequence is detected, or a wide-character code does not correspond to a valid character. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ |ATTRIBUTE TYPE |ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
read(2), fseek(3C), fsetpos(3C), rewind(3C), setbuf(3C), attributes(5), standards(5) SunOS 5.11 14 Aug 2002 ungetwc(3C)

Check Out this Related Man Page

UNGETWC(3)						     Linux Programmer's Manual							UNGETWC(3)

NAME
ungetwc - push back a wide character onto a FILE stream SYNOPSIS
#include <wchar.h> wint_t ungetwc(wint_t wc, FILE *stream); DESCRIPTION
The ungetwc() function is the wide-character equivalent of the ungetc(3) function. It pushes back a wide character onto stream and returns it. If wc is WEOF, it returns WEOF. If wc is an invalid wide character, it sets errno to EILSEQ and returns WEOF. If wc is a valid wide character, it is pushed back onto the stream and thus becomes available for future wide-character read operations. The file-position indicator is decremented by one or more. The end-of-file indicator is cleared. The backing storage of the file is not affected. Note: wc need not be the last wide-character read from the stream; it can be any other valid wide character. If the implementation supports multiple push-back operations in a row, the pushed-back wide characters will be read in reverse order; how- ever, only one level of push-back is guaranteed. RETURN VALUE
The ungetwc() function returns wc when successful, or WEOF upon failure. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------+---------------+---------+ |Interface | Attribute | Value | +----------+---------------+---------+ |ungetwc() | Thread safety | MT-Safe | +----------+---------------+---------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008, C99. NOTES
The behavior of ungetwc() depends on the LC_CTYPE category of the current locale. SEE ALSO
fgetwc(3) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2015-08-08 UNGETWC(3)
Man Page