actually saving everything that you retrieve.
18.1.3 Querying the Clipboard for Data Size
The problem with incremental retrieval is that numerous round trips to the server may be necessary in order to obtain
the entire contents of the clipboard. If you intend to save every bit of information you retrieve, the most economical
way to handle the retrieval is by reading everything in one fell swoop. A single call to XmClipboardRetrieve()
is more convenient than the three−step process involving locking the clipboard.
However, as pointed out earlier, we have a problem since we do not know how much data there is to read. The
solution to the problem is to determine exactly how much data there is by using
XmClipboardInquireLength(). This routine has the following form:
int
XmClipboardInquireLength(display, window, format_name, length)
Display *display;
Window window;
char *format;
unsigned long *length;
The function returns the amount of data being held by the clipboard under the specified format_name. In Example
17−3, we are looking for data in the "STRING" format. If any data on the clipboard is in this format, the function
returns ClipboardSuccess and the length parameter is set to the number of bytes being held. If there is no data
on the clipboard in the specified format, the function returns ClipboardNoData. If length is not set to a value
other than 0, the data cannot be read from the clipboard.
If XmClipboardInquireLength() is successful, then the number of bytes specified by length can be ...