]> git.saurik.com Git - apple/libc.git/blob - stdio/ungetwc.3
Libc-498.1.5.tar.gz
[apple/libc.git] / stdio / ungetwc.3
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. All advertising materials mentioning features or use of this software
19 .\" must display the following acknowledgement:
20 .\" This product includes software developed by the University of
21 .\" California, Berkeley and its contributors.
22 .\" 4. Neither the name of the University nor the names of its contributors
23 .\" may be used to endorse or promote products derived from this software
24 .\" without specific prior written permission.
25 .\"
26 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 .\" SUCH DAMAGE.
37 .\"
38 .\" @(#)ungetc.3 8.1 (Berkeley) 6/4/93
39 .\" $FreeBSD: src/lib/libc/stdio/ungetwc.3,v 1.5 2004/03/16 13:30:11 tjr Exp $
40 .\"
41 .Dd March 3, 2004
42 .Dt UNGETWC 3
43 .Os
44 .Sh NAME
45 .Nm ungetwc ,
46 .Nm ungetwc_l
47 .Nd un-get wide character from input stream
48 .Sh LIBRARY
49 .Lb libc
50 .Sh SYNOPSIS
51 .In stdio.h
52 .In wchar.h
53 .Ft wint_t
54 .Fo ungetwc
55 .Fa "wint_t wc"
56 .Fa "FILE *stream"
57 .Fc
58 .In stdio.h
59 .In wchar.h
60 .In xlocale.h
61 .Ft wint_t
62 .Fo ungetwc_l
63 .Fa "wint_t wc"
64 .Fa "FILE *stream"
65 .Fa "locale_t loc"
66 .Fc
67 .Sh DESCRIPTION
68 The
69 .Fn ungetwc
70 function pushes the wide character
71 .Fa wc
72 (converted to an
73 .Vt wchar_t )
74 back onto the input stream pointed to by
75 .Fa stream .
76 The pushed-backed wide characters will be returned (in reverse order)
77 by subsequent reads on the stream.
78 A successful intervening call to one of the file
79 positioning functions
80 .Xr fseek 3 ,
81 .Xr fsetpos 3 ,
82 or
83 .Xr rewind 3 ,
84 using the same stream,
85 will discard the pushed-back wide characters.
86 .Pp
87 Only one wide character of push-back is guaranteed,
88 but as long as there is sufficient memory,
89 an effectively infinite amount of push-back is allowed.
90 .Pp
91 If a character is successfully pushed-back,
92 the end-of-file indicator for the stream is cleared.
93 .Pp
94 Although the
95 .Fn ungetwc
96 function uses the current locale, the
97 .Fn ungetwc_l
98 function may be passed a locale directly. See
99 .Xr xlocale 3
100 for more information.
101 .Sh RETURN VALUES
102 The
103 .Fn ungetwc
104 function
105 returns
106 the wide character pushed-back after the conversion, or
107 .Dv WEOF
108 if the operation fails.
109 If the value of the argument
110 .Fa c
111 character equals
112 .Dv WEOF ,
113 the operation will fail and the stream will remain unchanged.
114 .Sh SEE ALSO
115 .Xr fseek 3 ,
116 .Xr getwc 3 ,
117 .Xr xlocale 3
118 .Sh STANDARDS
119 The
120 .Fn ungetwc
121 function conforms to
122 .St -isoC-99 .