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/wcstombs.3 165903 2007-01-09 00:28:16Z imp $ 350d5acd74SJohn Marino.\" 367d3de48cSSascha Wildner.Dd December 27, 2013 37eee2ef09SJoerg Sonnenberger.Dt WCSTOMBS 3 38eee2ef09SJoerg Sonnenberger.Os 39eee2ef09SJoerg Sonnenberger.Sh NAME 407d3de48cSSascha Wildner.Nm wcstombs , 417d3de48cSSascha Wildner.Nm wcstombs_l 420d5acd74SJohn Marino.Nd convert a wide-character string to a 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 wcstombs 490d5acd74SJohn Marino.Fa "char * restrict mbstring" "const wchar_t * restrict wcstring" 500d5acd74SJohn Marino.Fa "size_t nbytes" 510d5acd74SJohn Marino.Fc 527d3de48cSSascha Wildner.In xlocale.h 537d3de48cSSascha Wildner.Ft size_t 547d3de48cSSascha Wildner.Fo wcstombs_l 557d3de48cSSascha Wildner.Fa "char * restrict mbstring" "const wchar_t * restrict wcstring" 567d3de48cSSascha Wildner.Fa "size_t nbytes" "locale_t locale" 577d3de48cSSascha Wildner.Fc 58eee2ef09SJoerg Sonnenberger.Sh DESCRIPTION 59eee2ef09SJoerg SonnenbergerThe 60eee2ef09SJoerg Sonnenberger.Fn wcstombs 617d3de48cSSascha Wildnerand 627d3de48cSSascha Wildner.Fn wcstombs_l 637d3de48cSSascha Wildnerfunctions convert a wide character string 640d5acd74SJohn Marino.Fa wcstring 650d5acd74SJohn Marinointo a multibyte character string, 660d5acd74SJohn Marino.Fa mbstring , 670d5acd74SJohn Marinobeginning in the initial conversion state. 680d5acd74SJohn MarinoUp to 690d5acd74SJohn Marino.Fa nbytes 700d5acd74SJohn Marinobytes are stored in 710d5acd74SJohn Marino.Fa mbstring . 720d5acd74SJohn MarinoPartial multibyte characters at the end of the string are not stored. 730d5acd74SJohn MarinoThe multibyte character string is null terminated if there is room. 747d3de48cSSascha Wildner.Pp 757d3de48cSSascha WildnerThe 767d3de48cSSascha Wildner.Fn wcstombs_l 777d3de48cSSascha Wildnerfunction takes an explicit 787d3de48cSSascha Wildner.Fa locale 797d3de48cSSascha Wildnerargument, whereas the 807d3de48cSSascha Wildner.Fn wcstombs 817d3de48cSSascha Wildnerfunction uses the current global or per-thread locale. 82eee2ef09SJoerg Sonnenberger.Sh RETURN VALUES 830d5acd74SJohn MarinoThe 84eee2ef09SJoerg Sonnenberger.Fn wcstombs 857d3de48cSSascha Wildnerand 867d3de48cSSascha Wildner.Fn wcstombs_l 877d3de48cSSascha Wildnerfunctions return the number of bytes converted 887d3de48cSSascha Wildner(not including any terminating null), if successful, otherwise they return 890d5acd74SJohn Marino.Po Vt size_t Pc Ns \-1 . 90eee2ef09SJoerg Sonnenberger.Sh ERRORS 910d5acd74SJohn MarinoThe 92eee2ef09SJoerg Sonnenberger.Fn wcstombs 937d3de48cSSascha Wildnerand 947d3de48cSSascha Wildner.Fn wcstombs_l 957d3de48cSSascha Wildnerfunctions will fail if: 96eee2ef09SJoerg Sonnenberger.Bl -tag -width Er 97eee2ef09SJoerg Sonnenberger.It Bq Er EILSEQ 980d5acd74SJohn MarinoAn invalid wide character was encountered. 990d5acd74SJohn Marino.It Bq Er EINVAL 1000d5acd74SJohn MarinoThe conversion state is invalid. 101eee2ef09SJoerg Sonnenberger.El 102eee2ef09SJoerg Sonnenberger.Sh SEE ALSO 1030d5acd74SJohn Marino.Xr mbstowcs 3 , 1040d5acd74SJohn Marino.Xr multibyte 3 , 1050d5acd74SJohn Marino.Xr wcsrtombs 3 , 1067d3de48cSSascha Wildner.Xr wctomb 3 , 1077d3de48cSSascha Wildner.Xr xlocale 3 108eee2ef09SJoerg Sonnenberger.Sh STANDARDS 109eee2ef09SJoerg SonnenbergerThe 110eee2ef09SJoerg Sonnenberger.Fn wcstombs 111eee2ef09SJoerg Sonnenbergerfunction conforms to 112eee2ef09SJoerg Sonnenberger.St -isoC-99 . 113