'\" te .\" Copyright 1989 AT&T. Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. This notice shall appear on any product containing this material. .TH strxfrm 3C "10 Dec 2003" "SunOS 5.11" "Standard C Library Functions" .SH NAME strxfrm \- string transformation .SH SYNOPSIS .LP .nf #include \fBsize_t\fR \fBstrxfrm\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR, \fBsize_t\fR \fIn\fR); .fi .SH DESCRIPTION .sp .LP The \fBstrxfrm()\fR function transforms the string pointed to by \fIs2\fR and places the resulting string into the array pointed to by \fIs1\fR. The transformation is such that if \fBstrcmp\fR(3C) is applied to two transformed strings, it returns a value greater than, equal to or less than \fB0\fR, corresponding to the result of \fBstrcoll\fR(3C) applied to the same two original strings. No more than \fIn\fR bytes are placed into the resulting array pointed to by \fIs1\fR, including the terminating null byte. If \fIn\fR is \fB0\fR, \fIs1\fR is permitted to be a null pointer. If copying takes place between objects that overlap, the behavior is undefined. .sp .LP The \fBstrxfrm()\fR function does not change the setting of \fBerrno\fR if successful. .sp .LP Since no return value is reserved to indicate an error, an application wishing to check for error situations should set \fBerrno\fR to 0, then call \fBstrxfrm()\fR, then check \fBerrno\fR. .SH RETURN VALUES .sp .LP Upon successful completion, \fBstrxfrm()\fR returns the length of the transformed string (not including the terminating null byte). If the value returned is \fIn\fR or more, the contents of the array pointed to by \fIs1\fR are indeterminate. .sp .LP On error, \fBstrxfrm()\fR may set \fBerrno\fR but no return value is reserved to indicate the error. .SH USAGE .sp .LP The transformation function is such that two transformed strings can be ordered by \fBstrcmp\fR(3C) as appropriate to collating sequence information in the program's locale (category \fBLC_COLLATE\fR). .sp .LP The fact that when \fIn\fR is \fB0\fR, \fIs1\fR is permitted to be a null pointer, is useful to determine the size of the \fIs1\fR array prior to making the transformation. .SH EXAMPLES .LP \fBExample 1 \fRA sample of using the \fBstrxfm()\fR function. .sp .LP The value of the following expression is the size of the array needed to hold the transformation of the string pointed to by \fIs\fR. .sp .in +2 .nf 1 + strxfrm(NULL, s, 0); .fi .in -2 .SH FILES .sp .ne 2 .mk .na \fB\fB/usr/lib/locale/\fIlocale\fR/\fIlocale\fR.so.*\fR\fR .ad .sp .6 .RS 4n \fBLC_COLLATE\fR database for \fIlocale\fR .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ CSIEnabled _ Interface StabilityCommitted _ MT-LevelMT-Safe with exceptions _ StandardSee \fBstandards\fR(5). .TE .sp .LP The \fBstrxfrm()\fR function can be used safely in a multithreaded application, as long as \fBsetlocale\fR(3C) is not being called to change the locale. .SH SEE ALSO .sp .LP \fBlocaledef\fR(1), \fBsetlocale\fR(3C), \fBstrcmp\fR(3C), \fBstrcoll\fR(3C), \fBwscoll\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)