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: 

System exec running C code

I am running C code using the System Exec vi.   It executes some of the code and the stops.  The code executes from the terminal everytime without a hitch.  Could there be a conflict between system calls in C and the System Exec?  Other ideas and suggestions are appreciated.

0 Kudos
Message 1 of 8
(2,498 Views)

Could there be any 64/32 bit issues? I.e. LabVIEW being 32 bit while the c code is 64. Also, try running LabVIEW as an administartor, maybe that will help.

 

Which windows is it? Also, what do you mean it stops? Does it exit with an error code, crash?

 

Matt

0 Kudos
Message 2 of 8
(2,495 Views)

Im running on a MAC.  No error Code.  Works in way through most of the code, then stops - thinks its done. How do I run as an administrator?

 

0 Kudos
Message 3 of 8
(2,489 Views)

I assumed you're on Windows, I don't know anything about Mac. I imagine the admin issues I brought up above don't apply to Mac.

0 Kudos
Message 4 of 8
(2,487 Views)

Thanks for trying.

 

0 Kudos
Message 5 of 8
(2,485 Views)

How do you determine that it stops? What does happen and what not? Do you have control of the source code of the command line tool, so you can add console output to debug what happens?

 

The most likely reason is that your program expects certain conditions, such as process authorization, environment settings, etc, that are normally existent for a console style application started from the shell, but not as child process when started from a GUI application. The process started with SystemExec inherits all its environment, authorization and what else from the LabVIEW process and not from the unix shell, that you would normally use to start a consolde application. This has usually no consequences and in Windows it actually didn't make much of a difference until Vista was released. Under Unix/Linux things can be a bit more complicated as some of that security was built in from beginning.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 8
(2,481 Views)

Thanks.  Code just stops early.  Prints out a few lines of code; makes some files; but never runs completely.  However, sytem exec thinks it's done

0 Kudos
Message 7 of 8
(2,475 Views)

Then the program is done! But it may skip some of what you think it should do because of the reasons I mentioned. What are the user rights of your LabVIEW application? Does LabVIEW have access to all the file locations this program tries to access? Does this application store some configuration settings somewhere with a name generated internally?


Maybe the standard error output or the standard output of the SystemExec can give you some extra hints.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 8
(2,471 Views)