xref: /freebsd/lib/libc/stdio/ungetwc.3 (revision 4b9d6057)
1.\"	$NetBSD: ungetwc.3,v 1.3 2002/02/07 07:00:27 ross Exp $
2.\"
3.\" Copyright (c) 1990, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" This code is derived from software contributed to Berkeley by
7.\" Chris Torek and the American National Standards Committee X3,
8.\" on Information Processing Systems.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\" 3. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.Dd March 3, 2004
35.Dt UNGETWC 3
36.Os
37.Sh NAME
38.Nm ungetwc
39.Nd un-get wide character from input stream
40.Sh LIBRARY
41.Lb libc
42.Sh SYNOPSIS
43.In stdio.h
44.In wchar.h
45.Ft wint_t
46.Fn ungetwc "wint_t wc" "FILE *stream"
47.Sh DESCRIPTION
48The
49.Fn ungetwc
50function pushes the wide character
51.Fa wc
52(converted to an
53.Vt wchar_t )
54back onto the input stream pointed to by
55.Fa stream .
56The pushed-backed wide characters will be returned by subsequent reads on the
57stream (in reverse order).
58A successful intervening call, using the same stream, to one of the file
59positioning functions
60.Xr fseek 3 ,
61.Xr fsetpos 3 ,
62or
63.Xr rewind 3
64will discard the pushed back wide characters.
65.Pp
66One wide character of push-back is guaranteed,
67but as long as there is
68sufficient memory, an effectively infinite amount of pushback is allowed.
69.Pp
70If a character is successfully pushed-back,
71the end-of-file indicator for the stream is cleared.
72.Sh RETURN VALUES
73The
74.Fn ungetwc
75function
76returns
77the wide character pushed-back after the conversion, or
78.Dv WEOF
79if the operation fails.
80If the value of the argument
81.Fa c
82character equals
83.Dv WEOF ,
84the operation will fail and the stream will remain unchanged.
85.Sh SEE ALSO
86.Xr fseek 3 ,
87.Xr getwc 3
88.Sh STANDARDS
89The
90.Fn ungetwc
91function conforms to
92.St -isoC-99 .
93