XMTEXTGETSUBSTRING(3)
π XmTextGetSubstring π
okay so bestie, welcome to XmTextGetSubstring β she's a library call straight out of the XmText family, and she's here to grab you a lil copy of part of a Text widget's internal text buffer. no big deal. just a queen doing queen things. π
β¨ SYNOPSIS β¨
#include <Xm/Text.h>
int XmTextGetSubstring(
Widget widget,
XmTextPosition start,
int num_chars,
int buffer_size,
char *buffer);
πΈ DESCRIPTION πΈ
XmTextGetSubstring 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. slay, it's that simple. π
ngl the size of the required buffer depends on the maximum number of bytes per character (MB_CUR_MAX) for the current locale. MB_CUR_MAX is a macro defined in stdlib.h. 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:
buffer_size = (num_chars* MB_CUR_MAX) + 1
(void)
like, do the math bestie, don't come crying to me when your buffer is too small π
widgetβ Specifies the Text widget ID. it's giving "which widget are we even talking about" energy, so yeah, you gotta tell her.startβ 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 is0(zero). zero-indexed, iconic, no notes.num_charsβ Specifies the number of characters to be copied into the provided buffer.buffer_sizeβ Specifies the size of the supplied buffer in bytes. This size should account for aNULLterminator. yes, the terminator counts. she always counts. πbufferβ Specifies the character buffer into which the internal text buffer will be copied.
For a complete definition of Text and its associated resources, see XmText(3). go read it, i'll wait π«Ά
π₯ RETURN π₯
XmCOPY_SUCCEEDEDβ The function was successful. we ate. β¨XmCOPY_FAILEDβ 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 ofbufferare undefined.
β οΈ bestie listen to me: if you getXmCOPY_FAILED, the contents ofbufferare undefined. not "kinda off", not "mostly fine" β undefined. do not read it. do not print it. do not pass go. π
XmCOPY_TRUNCATEDβ The requested number of characters extended beyond the internal buffer. The function copied characters betweenstartand the end of the widget's buffer and terminated the string with aNULLterminator; fewer thannum_charscharacters were copied. she gave you what she had, okay? she's doing her best π₯Ί
π RELATED π
XmText(3) and XmTextGetSubstringWcs(3).
and that's the whole vibe check, bestie π this has been XmTextGetSubstring, filed under library call, right there in the XmText corner of the manual β go forth and copy substrings responsibly. mwah. π π¦ πΈ
π¦ where this page comes from
- alpine 3.24: motif-doc 2.5.2-r0 Β· LGPL-2.1-or-later
- arch rolling: openmotif 2.3.8-4 Β· LGPL-2.1-or-later
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- epel 10: motif-devel 2.3.8-2.el10_2 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- nixos 26.05: motif 2.3.8
- nixpkgs unstable: motif 2.3.8
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms