From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to the System clipboard

Interesting, and not behavior I'd ever tested out before now, from your description.  The ASCII NULL char holds no special significance to LabVIEW - which maintains string data as an array of char with an associated charcount - but to any software system with code written in a C dialect, strings are frequently assumed to be NULL terminated.

 

I just invoked a clipboard write and a subsequent read using a string with an embedded null char and got back exactly what I'd written.  When I went to paste into Notepad, the paste contents ended with the last character before the null.  Not too surprising.

 

So yes, looks like one fixto your problem is to replace (or remove) all the null chars before passing them to the clipboard.

 

By the way, you can quickly do this with the Search and Replace String node; but interestingly, NOT if you put it in "regular expression" mode, NOR can you use the more flexible "Match Pattern" node.  The Match Pattern node is implemented using the open source PCRE library, which uses C string handling, so that's a known limitation.  I'm not as sure how Search & Replace is implemented, but the limitation is there in regex mode.  Both nodes return error -4702 if the input or the search pattern contain a null.

 

Dave

David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
Message 11 of 11
(765 Views)