<!-- $XConsortium: TxtGetSG.sgm /main/8 1996/09/08 21:18:00 rws $ -->
<!-- (c) Copyright 1995 Digital Equipment Corporation. -->
<!-- (c) Copyright 1995 Hewlett-Packard Company. -->
<!-- (c) Copyright 1995 International Business Machines Corp. -->
<!-- (c) Copyright 1995 Sun Microsystems, Inc. -->
<!-- (c) Copyright 1995 Novell, Inc. -->
<!-- (c) Copyright 1995 FUJITSU LIMITED. -->
<!-- (c) Copyright 1995 Hitachi. -->

<RefEntry Id="CDEMMA.MAN522.rsml.1">
<RefMeta>
<RefEntryTitle>XmTextGetSubstring</RefEntryTitle>
<ManVolNum>library call</ManVolNum>
</RefMeta>
<RefNameDiv>
<RefName><Function>XmTextGetSubstring</Function></RefName>
<RefPurpose>A Text function that retrieves a copy
of a portion of the internal text buffer
<IndexTerm>
<Primary>XmTextGetSubstring</Primary>
</IndexTerm><IndexTerm>
<Primary>Text functions</Primary>
<Secondary>XmTextGetSubstring</Secondary>
</IndexTerm></RefPurpose>
</RefNameDiv>
<!-- -->
<!-- @OSF_COPYRIGHT@-->
<!-- COPYRIGHT NOTICE-->
<!-- Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.-->
<!-- ALL RIGHTS RESERVED (MOTIF). See the file named COPY.MOTIF.DOC for-->
<!-- the full copyright text.-->
<!-- -->
<!-- HISTORY-->
<!-- -->
<!-- **-->
<!-- **-->
<!-- **  (c) Copyright 1989, 1990, 1992 by Open Software Foundation, Inc.-->
<!-- **      All Rights Reserved.-->
<!-- **-->
<!-- **  (c) Copyright 1987, 1988, 1989, by Hewlett-Packard Company-->
<!-- **-->
<!-- **  (c) Copyright 1987, 1988 by Digital Equipment Corporation,-->
<!-- **      Maynard, MA.  All Rights Reserved.-->
<!-- **-->
<!-- **-->
<RefSynopsisDiv>
<FuncSynopsis>
<FuncSynopsisInfo>#include &lt;Xm/Text.h>
</FuncSynopsisInfo>
<FuncDef>int <Function>XmTextGetSubstring</Function></FuncDef>
<!--<ParamDef><Replaceable>widget, start, num_chars, buffer_size, buffer</Replaceable></ParamDef>-->
<ParamDef>Widget <Parameter>widget</Parameter></ParamDef>
<ParamDef>XmTextPosition <Parameter>start</Parameter></ParamDef>
<ParamDef>int <Parameter>num_chars</Parameter></ParamDef>
<ParamDef>int <Parameter>buffer_size</Parameter></ParamDef>
<ParamDef>char *<Parameter>buffer</Parameter></ParamDef>
</FuncSynopsis>
</RefSynopsisDiv>
<RefSect1>
<Title>DESCRIPTION</Title>
<Para><Function>XmTextGetSubstring</Function> retrieves a copy of a portion of the internal
text buffer of a Text widget. The function
copies a specified number of characters from a given start position
in the internal text buffer into a buffer provided by the
application. A NULL terminator is placed at the end of the copied data.
</Para>
<Para>The size of the required buffer depends on the maximum number of bytes
per character (<SystemItem Class="Constant">MB_CUR_MAX</SystemItem>) for the current locale.
<SystemItem Class="Constant">MB_CUR_MAX</SystemItem> is a macro defined in <Filename>stdlib.h</Filename>. The buffer
should be large enough to contain the substring to be copied and
a NULL terminator. Use the following equation to calculate the
size of buffer the application should provide:
</Para>
<FuncSynopsis>
<FuncSynopsisInfo><Replaceable>buffer_size</Replaceable> = (<Replaceable>num_chars</Replaceable>* MB_CUR_MAX) + 1</FuncSynopsisInfo>
<FuncDef></FuncDef>
<void>
</FuncSynopsis>
<VariableList>
<VarListEntry>
<Term><Symbol Role="Variable">widget</Symbol></Term>
<ListItem>
<Para>Specifies the Text widget ID.
</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term><Symbol Role="Variable">start</Symbol></Term>
<ListItem>
<Para>Specifies the beginning character position from which the data will be
retrieved. This is an integer number of characters from the beginning
of the text buffer. The first character position is 0 (zero).
</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term><Symbol Role="Variable">num_chars</Symbol></Term>
<ListItem>
<Para>Specifies the number of characters to be copied into the provided buffer.
</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term><Symbol Role="Variable">buffer_size</Symbol></Term>
<ListItem>
<Para>Specifies the size of the supplied buffer in bytes. This size
should account for a NULL terminator.
</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term><Symbol Role="Variable">buffer</Symbol></Term>
<ListItem>
<Para>Specifies the character buffer into which the internal
text buffer will be copied.
</Para>
</ListItem>
</VarListEntry>
</VariableList>
<Para>For a complete definition of Text and its associated resources,
see &cdeman.XmText;.
</Para>
</RefSect1>
<RefSect1>
<Title>RETURN</Title>
<VariableList>
<VarListEntry>
<Term><SystemItem Class="Constant">XmCOPY_SUCCEEDED</SystemItem></Term>
<ListItem>
<Para>The function was successful.
</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term><SystemItem Class="Constant">XmCOPY_FAILED</SystemItem></Term>
<ListItem>
<Para>The function failed because it was unable to copy the
specified number of characters into the buffer provided.
The buffer size may be insufficient. The contents of
<Symbol Role="Variable">buffer</Symbol> are undefined.
</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term><SystemItem Class="Constant">XmCOPY_TRUNCATED</SystemItem></Term>
<ListItem>
<Para>The requested number of characters extended beyond the internal
buffer. The function copied characters between <Symbol Role="Variable">start</Symbol> and the
end of the widget's buffer and terminated the string with a NULL
terminator; fewer than <Symbol Role="Variable">num_chars</Symbol> characters were copied.
</Para>
</ListItem>
</VarListEntry>
</VariableList>
</RefSect1>
<RefSect1>
<Title>RELATED</Title>
<Para>&cdeman.XmText; and &cdeman.XmTextGetSubstringWcs;.
</Para>
</RefSect1>
</RefEntry>
<!--fickle 1.09 7/2/95-->
