Admin Production ni-theme
Current Publication

ClipboardGetText

LabWindows/CVI

ClipboardGetText

int ClipboardGetText (char **text, int *available);

Purpose

Determines whether or not a text string is available on the system clipboard and optionally retrieves a copy of the text.

When the copy of the text is no longer needed, free it by calling the ANSI C Library free function.

(Linux) This function accesses only the internal LabWindows/CVI clipboard, not the host system clipboard.

You can run the following example in the Interactive Execution Window.

char *text;

ClipboardGetText (&text, 0);
if (text != 0)

printf ("clipboard text is '%s'\n", text);

else

printf ("there is no text on the clipboard\n");

free (text);

Parameters

Output
Name Type Description
text char * Pointer to the null-terminated string copied from the clipboard.

If no text exists on the clipboard, this pointer is set to NULL.

If you want to check whether text is on the clipboard but do not want to retrieve it, pass 0 for this parameter.

When the pointer is no longer needed, free the pointer by calling the free function.
available int Indicates whether text is available on the system clipboard.

This parameter is set to 1 if a text string is available on the system clipboard, 0 otherwise.

You can pass NULL for this parameter.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later

Example

Refer to userint\clipbord.cws for an example of using the ClipboardGetText function.