XMTEXTFIELDGETSUBSTRING(3)
β¨ NAME β¨
XmTextFieldGetSubstring β a TextField function that retrieves a copy of a portion of the internal text buffer π«Ά
πΈ SYNOPSIS πΈ
#include <Xm/TextF.h>
int XmTextFieldGetSubstring(
Widget widget,
XmTextPosition start,
int num_chars,
int buffer_size,
char *buffer);
π DESCRIPTION π
okay so bestie, listen. XmTextFieldGetSubstring retrieves a copy of a portion of the internal text buffer of a TextField widget. literally it copies a specified number of characters from a given start position in the internal text buffer into a buffer that you, the application, provide. and yes, a NULL terminator gets placed at the end of the copied data. slay. β¨
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. so your buffer should be large enough to contain the substring to be copied and a NULL terminator. use this equation to calculate the size of buffer the application should provide:
buffer_size = (num_chars* MB_CUR_MAX) + 1
(void)
π the parameters (the whole cast, main character energy) π
widgetβ Specifies the TextField widget ID. πͺͺ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). not one. zero. iykyk. π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. do not forget the terminator, i am begging πbufferβ Specifies the character buffer into which the internal text buffer will be copied.
for a complete definition of TextField and its associated resources, see XmTextField(3). go read it, it's giving essential. π
π₯ RETURN π₯
XmCOPY_SUCCEEDEDβ The function was successful. 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. yeah that's the scary one, no cap. π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. so you got some of it, just not all of it. π
π RELATED π
XmTextField(3) and XmTextFieldGetSubstringWcs(3). β¨
and that's the whole page, bestie π¦ this was XmTextFieldGetSubstring, a library call straight out of the Xm crew β footer said so and everything. now go forth and never forget that + 1 for the NULL terminator. periodt. π
π¦ 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