LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the return code of an exec-called program

I'm trying to simply call an .EXE (Win32 console-) application from LabView 5, which works fine with EXEC. The problem is, that I cannot query the return code of the program afterwards. (The error output is always 0, no matter what the program has returned.) Anyone knows a nice short solution to that? Thanks!
0 Kudos
Message 1 of 8
(3,351 Views)
ritter,

What exactly are you trying to do.

I believe that the outputs of the system exec are strictly for dataflow purposes.

Try looking at the help file for the system exec function for more information.

Good luck.
0 Kudos
Message 2 of 8
(3,351 Views)
I call an .EXE that returns with 0 when everything is ok and exits with an error code != 0 when there was an error. And I would like to get this error code (that can be queried with errorlevel in DOS) into LabView. (The info about exec didn't help me with that.)
0 Kudos
Message 3 of 8
(3,351 Views)
Hi ritter,

I'll take a try at this one (as I cover my head).
1)How about wiring to the standard output?

2)How about redirecting(piping) the output to a text file and checking it there?

Let us know if these are not appropriate ideas,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 8
(3,351 Views)
Hi Ben,
The problems in the called .EXE arise (usually) from the file system. Thats why I would not like to make the communication to LabView also file system dependent.
Taking the standard output of the .EXE directly into LabView would be a solution. But how do I do that? Can I get the output of the program right into LabView? Into a string?
Thanks anyways!
0 Kudos
Message 5 of 8
(3,351 Views)
Hi Ritter,

Somehow I think I may be missing something.
(after looking around)
What version of LV are you using?
I am guessing 5.1 or earlier.
LV 6 EXEC has standard output available.

If you are using LV 5.1.1 or so, I can only recomend the the re-directed solution.
If file system is issue how about using a complete file spec starting with "c:"? Do you expect to be running on a machine that does not have a c drive?

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 8
(3,351 Views)
You're right, we're using LV 5.1. And I guess there's really no more soffisticated solution than using some temp file... 😞
0 Kudos
Message 7 of 8
(3,351 Views)
Well, in that same line, you may want to look at the following examples:

How to Run an Executable with Options from LabVIEW

Programmatic ping Implementation

At least, they can provide you with some guidance.

Best regards;
Enrique
www.vartortech.com
0 Kudos
Message 8 of 8
(3,351 Views)