Solaris Common Desktop Environment: Motif Transition Guide

Character Strings and XmStrings

This section describes how to convert between character strings and XmStrings.

To Convert from Character String to XmString

In Motif, you must make an explicit call to convert a string to XmString, an internal representation of the string. If you internationalize your application, use XmStringCreateLocalized() to perform this conversion.

In Solaris Motif--unlike in Motif 1.2.3--XmStringCreateLocalized() recognizes \n as a line separator, so a string can have multiple lines.

To Convert from XmString to Character String

To convert from XmString to a character string, you must traverse the compound string and retrieve each segment individually. See section 19.3.3 of the Motif Programming Manual, Volume 6A, which contains a code sample that performs this conversion.

Do not use XmStringGetLtoR() to convert from XmString to a character string. This function assumes the text is oriented left-to-right.