LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Output to command line in Linux with built exe

Hi Folks,

Here's an interesting challenge...

I've got a VI that a customer wants to use as a command line utility in Linux.  I've gotten command line arguments in without any problem.  However, I can't seem to figure out how to get strings back out to the prompt.  The first thing I tried was the system exec VI that's in the communication palette.  Is there something silly I've overlooked?

I've also seen some very limited discussion on how to output to the command line using Windows API calls.  However, please remember that I'm trying to output to the command line in Linux.

Thanks very much as always.

Jim



0 Kudos
Message 1 of 5
(3,339 Views)

Hi Jim,

The best I think I can do to help you is to get you to call your local NI rep.

I seem to remeber seeing a set-up screen for the new app builder in LV 8.0 that may have offered that fuctionality. If I am wrong please forgive! I just have this faint image in my head that makes me want to go check to see if that was real or just a dream.

 

Please let us know your findings,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 5
(3,321 Views)
Hi Jim,

You can accomplish this using the pipe commands. Just don't open the handle, stdout (0), stdin (1), and stderr (2) are always open. See the attatched VI.

For the record, I haven't tried this as an executable, but it works running in LabVIEW and I have no reason to expect that it wouldn't work as an exe.

Jason


Message 3 of 5
(3,317 Views)
You could probably use the c node to use the printf functions and pipe the output to the standard out command line.  I haven't done this with labview and don't think I would, since you could easily make a popup window to emulate a command line output.  I guess the advantage with allowing piping is that in Linux/Unix environments you can use for interprocess communications.  Sorry its been over a year since I have had a chance to play with the alternative environments.
 
paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 5
(3,309 Views)
Jason, your idea worked beautifully.  Once I actually got my hands on LabVIEW for Linux and messed around with the pipe palette, it did exactly what I wanted it to. 

However, to anyone else reading this, "Write To Pipe.vi" will return an error if you write to file descriptor 0 (stdout) when the VI wasn't called from the command line.  If anyone gets error 1, that's most likely why it's occurring.

Many thanks to everyone who offered suggestions.

Jim
Message 5 of 5
(3,279 Views)