xref: /freebsd/lib/libc/stdio/ungetwc.3 (revision 46624699bd9486548307f128eb9447e691c08b75)
101533af5STim J. Robbins.\"	$NetBSD: ungetwc.3,v 1.3 2002/02/07 07:00:27 ross Exp $
201533af5STim J. Robbins.\"
301533af5STim J. Robbins.\" Copyright (c) 1990, 1991, 1993
401533af5STim J. Robbins.\"	The Regents of the University of California.  All rights reserved.
501533af5STim J. Robbins.\"
601533af5STim J. Robbins.\" This code is derived from software contributed to Berkeley by
701533af5STim J. Robbins.\" Chris Torek and the American National Standards Committee X3,
801533af5STim J. Robbins.\" on Information Processing Systems.
901533af5STim J. Robbins.\"
1001533af5STim J. Robbins.\" Redistribution and use in source and binary forms, with or without
1101533af5STim J. Robbins.\" modification, are permitted provided that the following conditions
1201533af5STim J. Robbins.\" are met:
1301533af5STim J. Robbins.\" 1. Redistributions of source code must retain the above copyright
1401533af5STim J. Robbins.\"    notice, this list of conditions and the following disclaimer.
1501533af5STim J. Robbins.\" 2. Redistributions in binary form must reproduce the above copyright
1601533af5STim J. Robbins.\"    notice, this list of conditions and the following disclaimer in the
1701533af5STim J. Robbins.\"    documentation and/or other materials provided with the distribution.
1801533af5STim J. Robbins.\" 3. All advertising materials mentioning features or use of this software
1901533af5STim J. Robbins.\"    must display the following acknowledgement:
2001533af5STim J. Robbins.\"	This product includes software developed by the University of
2101533af5STim J. Robbins.\"	California, Berkeley and its contributors.
2201533af5STim J. Robbins.\" 4. Neither the name of the University nor the names of its contributors
2301533af5STim J. Robbins.\"    may be used to endorse or promote products derived from this software
2401533af5STim J. Robbins.\"    without specific prior written permission.
2501533af5STim J. Robbins.\"
2601533af5STim J. Robbins.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2701533af5STim J. Robbins.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2801533af5STim J. Robbins.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2901533af5STim J. Robbins.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3001533af5STim J. Robbins.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3101533af5STim J. Robbins.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3201533af5STim J. Robbins.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3301533af5STim J. Robbins.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3401533af5STim J. Robbins.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3501533af5STim J. Robbins.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3601533af5STim J. Robbins.\" SUCH DAMAGE.
3701533af5STim J. Robbins.\"
3801533af5STim J. Robbins.\"     @(#)ungetc.3	8.1 (Berkeley) 6/4/93
3901533af5STim J. Robbins.\" $FreeBSD$
4001533af5STim J. Robbins.\"
4101533af5STim J. Robbins.Dd October 24, 2001
4201533af5STim J. Robbins.Dt UNGETWC 3
4301533af5STim J. Robbins.Os
4401533af5STim J. Robbins.Sh NAME
4501533af5STim J. Robbins.Nm ungetwc
4601533af5STim J. Robbins.Nd un-get wide-character from input stream
4701533af5STim J. Robbins.Sh LIBRARY
4801533af5STim J. Robbins.Lb libc
4901533af5STim J. Robbins.Sh SYNOPSIS
5046624699STim J. Robbins.In stdio.h
5146624699STim J. Robbins.In wchar.h
5201533af5STim J. Robbins.Ft wint_t
5301533af5STim J. Robbins.Fn ungetwc "wint_t wc" "FILE *stream"
5401533af5STim J. Robbins.Sh DESCRIPTION
5501533af5STim J. RobbinsThe
5601533af5STim J. Robbins.Fn ungetwc
5701533af5STim J. Robbinsfunction pushes the wide-character
5801533af5STim J. Robbins.Fa wc
5901533af5STim J. Robbins(converted to an wchar_t)
6001533af5STim J. Robbinsback onto the input stream pointed to by
6101533af5STim J. Robbins.Fa stream .
6201533af5STim J. RobbinsThe pushed-backed wide-characters will be returned by subsequent reads on the
6301533af5STim J. Robbinsstream (in reverse order).
6401533af5STim J. RobbinsA successful intervening call, using the same stream, to one of the file
6501533af5STim J. Robbinspositioning functions
6601533af5STim J. Robbins.Xr fseek 3 ,
6701533af5STim J. Robbins.Xr fsetpos 3 ,
6801533af5STim J. Robbinsor
6901533af5STim J. Robbins.Xr rewind 3
7001533af5STim J. Robbinswill discard the pushed back wide-characters.
7101533af5STim J. Robbins.Pp
7201533af5STim J. RobbinsOne wide-character of push-back is guaranteed,
7301533af5STim J. Robbinsbut as long as there is
7401533af5STim J. Robbinssufficient memory, an effectively infinite amount of pushback is allowed.
7501533af5STim J. Robbins.Pp
7601533af5STim J. RobbinsIf a character is successfully pushed-back,
7701533af5STim J. Robbinsthe end-of-file indicator for the stream is cleared.
7801533af5STim J. Robbins.Sh RETURN VALUES
7901533af5STim J. RobbinsThe
8001533af5STim J. Robbins.Fn ungetwc
8101533af5STim J. Robbinsfunction
8201533af5STim J. Robbinsreturns
8301533af5STim J. Robbinsthe wide-character pushed-back after the conversion, or
8401533af5STim J. Robbins.Dv WEOF
8501533af5STim J. Robbinsif the operation fails.
8601533af5STim J. RobbinsIf the value of the argument
8701533af5STim J. Robbins.Fa c
8801533af5STim J. Robbinscharacter equals
8901533af5STim J. Robbins.Dv WEOF ,
9001533af5STim J. Robbinsthe operation will fail and the stream will remain unchanged.
9101533af5STim J. Robbins.Sh SEE ALSO
9201533af5STim J. Robbins.Xr fseek 3 ,
9301533af5STim J. Robbins.Xr getwc 3
9401533af5STim J. Robbins.Sh STANDARDS
9501533af5STim J. RobbinsThe
9601533af5STim J. Robbins.Fn ungetwc
9701533af5STim J. Robbinsfunction conforms to
9846624699STim J. Robbins.St -isoC-99 .
9901533af5STim J. Robbins.Sh BUGS
10001533af5STim J. RobbinsThe current implementation uses a fixed sized ungetwc-buffer.
101