10d5acd74SJohn Marino.\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved. 20d5acd74SJohn Marino.\" Copyright (c) 1993 30d5acd74SJohn Marino.\" The Regents of the University of California. All rights reserved. 4eee2ef09SJoerg Sonnenberger.\" 50d5acd74SJohn Marino.\" This code is derived from software contributed to Berkeley by 60d5acd74SJohn Marino.\" Donn Seeley of BSDI. 7eee2ef09SJoerg Sonnenberger.\" 8eee2ef09SJoerg Sonnenberger.\" Redistribution and use in source and binary forms, with or without 9eee2ef09SJoerg Sonnenberger.\" modification, are permitted provided that the following conditions 10eee2ef09SJoerg Sonnenberger.\" are met: 11eee2ef09SJoerg Sonnenberger.\" 1. Redistributions of source code must retain the above copyright 12eee2ef09SJoerg Sonnenberger.\" notice, this list of conditions and the following disclaimer. 13eee2ef09SJoerg Sonnenberger.\" 2. Redistributions in binary form must reproduce the above copyright 14eee2ef09SJoerg Sonnenberger.\" notice, this list of conditions and the following disclaimer in the 15eee2ef09SJoerg Sonnenberger.\" documentation and/or other materials provided with the distribution. 16*c66c7e2fSzrj.\" 3. Neither the name of the University nor the names of its contributors 170d5acd74SJohn Marino.\" may be used to endorse or promote products derived from this software 180d5acd74SJohn Marino.\" without specific prior written permission. 19eee2ef09SJoerg Sonnenberger.\" 200d5acd74SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21eee2ef09SJoerg Sonnenberger.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22eee2ef09SJoerg Sonnenberger.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 230d5acd74SJohn Marino.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24eee2ef09SJoerg Sonnenberger.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25eee2ef09SJoerg Sonnenberger.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26eee2ef09SJoerg Sonnenberger.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27eee2ef09SJoerg Sonnenberger.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28eee2ef09SJoerg Sonnenberger.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29eee2ef09SJoerg Sonnenberger.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30eee2ef09SJoerg Sonnenberger.\" SUCH DAMAGE. 31eee2ef09SJoerg Sonnenberger.\" 320d5acd74SJohn Marino.\" From @(#)multibyte.3 8.1 (Berkeley) 6/4/93 330d5acd74SJohn Marino.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp 340d5acd74SJohn Marino.\" $FreeBSD: head/lib/libc/locale/mbstowcs.3 165903 2007-01-09 00:28:16Z imp $ 350d5acd74SJohn Marino.\" 367d3de48cSSascha Wildner.Dd December 26, 2013 37eee2ef09SJoerg Sonnenberger.Dt MBSTOWCS 3 38eee2ef09SJoerg Sonnenberger.Os 39eee2ef09SJoerg Sonnenberger.Sh NAME 407d3de48cSSascha Wildner.Nm mbstowcs , 417d3de48cSSascha Wildner.Nm mbstowcs_l 420d5acd74SJohn Marino.Nd convert a character string to a wide-character string 43eee2ef09SJoerg Sonnenberger.Sh LIBRARY 44eee2ef09SJoerg Sonnenberger.Lb libc 45eee2ef09SJoerg Sonnenberger.Sh SYNOPSIS 46eee2ef09SJoerg Sonnenberger.In stdlib.h 47eee2ef09SJoerg Sonnenberger.Ft size_t 480d5acd74SJohn Marino.Fo mbstowcs 490d5acd74SJohn Marino.Fa "wchar_t * restrict wcstring" "const char * restrict mbstring" 500d5acd74SJohn Marino.Fa "size_t nwchars" 510d5acd74SJohn Marino.Fc 527d3de48cSSascha Wildner.In xlocale.h 537d3de48cSSascha Wildner.Ft size_t 547d3de48cSSascha Wildner.Fo mbstowcs_l 557d3de48cSSascha Wildner.Fa "wchar_t * restrict wcstring" "const char * restrict mbstring" 567d3de48cSSascha Wildner.Fa "size_t nwchars" "locale_t locale" 577d3de48cSSascha Wildner.Fc 58eee2ef09SJoerg Sonnenberger.Sh DESCRIPTION 59eee2ef09SJoerg SonnenbergerThe 60eee2ef09SJoerg Sonnenberger.Fn mbstowcs 617d3de48cSSascha Wildnerand 627d3de48cSSascha Wildner.Fn mbstowcs_l 637d3de48cSSascha Wildnerfunctions convert a multibyte character string 640d5acd74SJohn Marino.Fa mbstring 650d5acd74SJohn Marinobeginning in the initial conversion state 660d5acd74SJohn Marinointo a wide character string 670d5acd74SJohn Marino.Fa wcstring . 680d5acd74SJohn MarinoNo more than 690d5acd74SJohn Marino.Fa nwchars 700d5acd74SJohn Marinowide characters are stored. 710d5acd74SJohn MarinoA terminating null wide character is appended if there is room. 727d3de48cSSascha Wildner.Pp 737d3de48cSSascha WildnerThe 747d3de48cSSascha Wildner.Fn mbstowcs_l 757d3de48cSSascha Wildnerfunction takes an explicit 767d3de48cSSascha Wildner.Fa locale 777d3de48cSSascha Wildnerargument, whereas the 787d3de48cSSascha Wildner.Fn mbstowcs 797d3de48cSSascha Wildnerfunction uses the current global or per-thread locale. 800d5acd74SJohn Marino.Sh RETURN VALUES 810d5acd74SJohn MarinoThe 82eee2ef09SJoerg Sonnenberger.Fn mbstowcs 837d3de48cSSascha Wildnerand 847d3de48cSSascha Wildner.Fn mbstowcs_l 857d3de48cSSascha Wildnerfunctions return the number of wide characters converted, 860d5acd74SJohn Marinonot counting any terminating null wide character, or \-1 870d5acd74SJohn Marinoif an invalid multibyte character was encountered. 880d5acd74SJohn Marino.Sh ERRORS 890d5acd74SJohn MarinoThe 900d5acd74SJohn Marino.Fn mbstowcs 917d3de48cSSascha Wildnerand 927d3de48cSSascha Wildner.Fn mbstowcs_l 937d3de48cSSascha Wildnerfunctions will fail if: 94eee2ef09SJoerg Sonnenberger.Bl -tag -width Er 95eee2ef09SJoerg Sonnenberger.It Bq Er EILSEQ 960d5acd74SJohn MarinoAn invalid multibyte sequence was detected. 970d5acd74SJohn Marino.It Bq Er EINVAL 980d5acd74SJohn MarinoThe conversion state is invalid. 99eee2ef09SJoerg Sonnenberger.El 100eee2ef09SJoerg Sonnenberger.Sh SEE ALSO 1010d5acd74SJohn Marino.Xr mbsrtowcs 3 , 102eee2ef09SJoerg Sonnenberger.Xr mbtowc 3 , 1037d3de48cSSascha Wildner.Xr multibyte 3 , 1047d3de48cSSascha Wildner.Xr xlocale 3 105eee2ef09SJoerg Sonnenberger.Sh STANDARDS 106eee2ef09SJoerg SonnenbergerThe 107eee2ef09SJoerg Sonnenberger.Fn mbstowcs 108eee2ef09SJoerg Sonnenbergerfunction conforms to 109eee2ef09SJoerg Sonnenberger.St -isoC-99 . 110