]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/wctomb.3
Import of man-pages 1.70
[thirdparty/man-pages.git] / man3 / wctomb.3
1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2 .\"
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
7 .\"
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
10 .\" Dinkumware C library reference http://www.dinkumware.com/
11 .\" OpenGroup's Single Unix specification http://www.UNIX-systems.org/online.html
12 .\" ISO/IEC 9899:1999
13 .\"
14 .TH WCTOMB 3 1999-07-25 "GNU" "Linux Programmer's Manual"
15 .SH NAME
16 wctomb \- convert a wide character to a multibyte sequence
17 .SH SYNOPSIS
18 .nf
19 .B #include <stdlib.h>
20 .sp
21 .BI "int wctomb(char *" s ", wchar_t " wc );
22 .fi
23 .SH DESCRIPTION
24 If \fIs\fP is not NULL, the \fBwctomb\fP function converts the wide character
25 \fIwc\fP to its multibyte representation and stores it at the beginning of
26 the character array pointed to by \fIs\fP. It updates the shift state, which
27 is stored in a static anonymous variable only known to the wctomb function,
28 and returns the length of said multibyte representation, i.e. the number of
29 bytes written at \fIs\fP.
30 .PP
31 The programmer must ensure that there is room for at least \fBMB_CUR_MAX\fP
32 bytes at \fIs\fP.
33 .PP
34 If \fIs\fP is NULL, the \fBwctomb\fP function
35 .\" The Dinkumware doc and the Single Unix specification say this, but
36 .\" glibc doesn't implement this.
37 resets the shift state, only known to this function, to the initial state, and
38 returns non-zero if the encoding has non-trivial shift state, or zero if the
39 encoding is stateless.
40 .SH "RETURN VALUE"
41 If \fIs\fP is not NULL, the \fBwctomb\fP function returns the number of bytes
42 that have been written to the byte array at \fIs\fP. If \fIwc\fP can not be
43 represented as a multibyte sequence (according to the current locale), \-1 is
44 returned.
45 .PP
46 If \fIs\fP is NULL, the \fBwctomb\fP function returns non-zero if the
47 encoding has non-trivial shift state, or zero if the encoding is stateless.
48 .SH "CONFORMING TO"
49 ISO/ANSI C, UNIX98
50 .SH "SEE ALSO"
51 .BR MB_CUR_MAX (3),
52 .BR wcrtomb (3),
53 .BR wcstombs (3)
54 .SH NOTES
55 The behaviour of \fBwctomb\fP depends on the LC_CTYPE category of the
56 current locale.
57 .PP
58 This function is not multi-thread safe. The function \fBwcrtomb\fP provides
59 a better interface to the same functionality.