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