xref: /netbsd-src/lib/libc/stdio/getwc.3 (revision c4a45014009702ef76a1d4bf6fbca435f72e6a79)
1*c4a45014Sabhinav.\"	$NetBSD: getwc.3,v 1.10 2017/10/25 17:03:30 abhinav Exp $
217f3654aSyamt.\"
317f3654aSyamt.\" Copyright (c) 1990, 1991, 1993
417f3654aSyamt.\"	The Regents of the University of California.  All rights reserved.
517f3654aSyamt.\"
617f3654aSyamt.\" This code is derived from software contributed to Berkeley by
717f3654aSyamt.\" Chris Torek and the American National Standards Committee X3,
817f3654aSyamt.\" on Information Processing Systems.
917f3654aSyamt.\"
1017f3654aSyamt.\" Redistribution and use in source and binary forms, with or without
1117f3654aSyamt.\" modification, are permitted provided that the following conditions
1217f3654aSyamt.\" are met:
1317f3654aSyamt.\" 1. Redistributions of source code must retain the above copyright
1417f3654aSyamt.\"    notice, this list of conditions and the following disclaimer.
1517f3654aSyamt.\" 2. Redistributions in binary form must reproduce the above copyright
1617f3654aSyamt.\"    notice, this list of conditions and the following disclaimer in the
1717f3654aSyamt.\"    documentation and/or other materials provided with the distribution.
18eb7c1594Sagc.\" 3. Neither the name of the University nor the names of its contributors
1917f3654aSyamt.\"    may be used to endorse or promote products derived from this software
2017f3654aSyamt.\"    without specific prior written permission.
2117f3654aSyamt.\"
2217f3654aSyamt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2317f3654aSyamt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2417f3654aSyamt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2517f3654aSyamt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2617f3654aSyamt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2717f3654aSyamt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2817f3654aSyamt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2917f3654aSyamt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3017f3654aSyamt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3117f3654aSyamt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3217f3654aSyamt.\" SUCH DAMAGE.
3317f3654aSyamt.\"
3417f3654aSyamt.\"     @(#)getc.3	8.1 (Berkeley) 6/4/93
3517f3654aSyamt.\"
36aa18298cSjruoho.Dd May 6, 2010
3717f3654aSyamt.Dt GETWC 3
3817f3654aSyamt.Os
3917f3654aSyamt.Sh NAME
4017f3654aSyamt.Nm fgetwc ,
4117f3654aSyamt.Nm getwc ,
42*c4a45014Sabhinav.Nm getwchar
433d3c5d42Swiz.Nd get next wide character from input stream
4417f3654aSyamt.Sh LIBRARY
4517f3654aSyamt.Lb libc
4617f3654aSyamt.Sh SYNOPSIS
47472351e1Swiz.In stdio.h
48472351e1Swiz.In wchar.h
4917f3654aSyamt.Ft wint_t
5017f3654aSyamt.Fn fgetwc "FILE *stream"
5117f3654aSyamt.Ft wint_t
5217f3654aSyamt.Fn getwc "FILE *stream"
5317f3654aSyamt.Ft wint_t
5417f3654aSyamt.Fn getwchar
5517f3654aSyamt.Sh DESCRIPTION
5617f3654aSyamtThe
5717f3654aSyamt.Fn fgetwc
5817f3654aSyamtfunction
593d3c5d42Swizobtains the next input wide character (if present) from the stream pointed at by
6017f3654aSyamt.Fa stream ,
6117f3654aSyamtor the next character pushed back on the stream via
6217f3654aSyamt.Xr ungetwc 3 .
6317f3654aSyamt.Pp
6417f3654aSyamtThe
6517f3654aSyamt.Fn getwc
6617f3654aSyamtfunction
6717f3654aSyamtacts essentially identically to
6817f3654aSyamt.Fn fgetwc ,
6917f3654aSyamtbut is a macro that expands in-line.
7017f3654aSyamt.Pp
7117f3654aSyamtThe
7217f3654aSyamt.Fn getwchar
7317f3654aSyamtfunction
74881a6c7dSwizis equivalent to
75881a6c7dSwiz.Fn getwc
76881a6c7dSwizwith the argument stdin.
7717f3654aSyamt.Sh RETURN VALUES
783d3c5d42SwizIf successful, these routines return the next wide character
7917f3654aSyamtfrom the
8017f3654aSyamt.Fa stream .
8117f3654aSyamtIf the stream is at end-of-file or a read error occurs,
8217f3654aSyamtthe routines return
8317f3654aSyamt.Dv WEOF .
8417f3654aSyamtThe routines
8517f3654aSyamt.Xr feof 3
8617f3654aSyamtand
8717f3654aSyamt.Xr ferror 3
8817f3654aSyamtmust be used to distinguish between end-of-file and error.
8917f3654aSyamtIf an error occurs, the global variable
9017f3654aSyamt.Va errno
9117f3654aSyamtis set to indicate the error.
9217f3654aSyamtThe end-of-file condition is remembered, even on a terminal, and all
9317f3654aSyamtsubsequent attempts to read will return
9417f3654aSyamt.Dv WEOF
9517f3654aSyamtuntil the condition is cleared with
9617f3654aSyamt.Xr clearerr 3 .
9717f3654aSyamt.Sh SEE ALSO
9817f3654aSyamt.Xr ferror 3 ,
9917f3654aSyamt.Xr fopen 3 ,
10017f3654aSyamt.Xr fread 3 ,
10117f3654aSyamt.Xr putwc 3 ,
10217f3654aSyamt.Xr stdio 3 ,
10317f3654aSyamt.Xr ungetwc 3
10417f3654aSyamt.Sh STANDARDS
10517f3654aSyamtThe
10617f3654aSyamt.Fn fgetwc ,
10717f3654aSyamt.Fn getwc
10817f3654aSyamtand
10917f3654aSyamt.Fn getwchar
11017f3654aSyamtfunctions
11117f3654aSyamtconform to
112aa18298cSjruoho.St -isoC-99
113aa18298cSjruohoand
114aa18298cSjruoho.St -p1003.1-2001 .
115