1XmTextGetSubstring(library call) XmTextGetSubstring(library call)
2
3
4
6 XmTextGetSubstring — A Text function that retrieves a copy of a portion
7 of the internal text buffer
8
10 #include <Xm/Text.h>
11 int XmTextGetSubstring(
12 Widget widget,
13 XmTextPosition start,
14 int num_chars,
15 int buffer_size,
16 char *buffer);
17
19 XmTextGetSubstring retrieves a copy of a portion of the internal text
20 buffer of a Text widget. The function copies a specified number of
21 characters from a given start position in the internal text buffer into
22 a buffer provided by the application. A NULL terminator is placed at
23 the end of the copied data.
24
25 The size of the required buffer depends on the maximum number of bytes
26 per character (MB_CUR_MAX) for the current locale. MB_CUR_MAX is a
27 macro defined in stdlib.h. The buffer should be large enough to contain
28 the substring to be copied and a NULL terminator. Use the following
29 equation to calculate the size of buffer the application should pro‐
30 vide:
31
32 buffer_size = (num_chars* MB_CUR_MAX) + 1
33 (void)
34
35 widget Specifies the Text widget ID.
36
37 start Specifies the beginning character position from which the
38 data will be retrieved. This is an integer number of charac‐
39 ters from the beginning of the text buffer. The first charac‐
40 ter position is 0 (zero).
41
42 num_chars Specifies the number of characters to be copied into the pro‐
43 vided buffer.
44
45 buffer_size
46 Specifies the size of the supplied buffer in bytes. This size
47 should account for a NULL terminator.
48
49 buffer Specifies the character buffer into which the internal text
50 buffer will be copied.
51
52 For a complete definition of Text and its associated resources, see
53 XmText(3).
54
56 XmCOPY_SUCCEEDED
57 The function was successful.
58
59 XmCOPY_FAILED
60 The function failed because it was unable to copy the speci‐
61 fied number of characters into the buffer provided. The buf‐
62 fer size may be insufficient. The contents of buffer are
63 undefined.
64
65 XmCOPY_TRUNCATED
66 The requested number of characters extended beyond the inter‐
67 nal buffer. The function copied characters between start and
68 the end of the widget's buffer and terminated the string with
69 a NULL terminator; fewer than num_chars characters were
70 copied.
71
73 XmText(3) and XmTextGetSubstringWcs(3).
74
75
76
77 XmTextGetSubstring(library call)