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: 

file type in linux labview

Solved!
Go to solution

How to identify a file is an labview app file in linux labview, I want to search all the files in the folder, determine which is the labview app file, and then run it

0 Kudos
Message 1 of 5
(1,609 Views)

I'm uncertain what you mean by a "LabVIEW App File", and why you are restricting your discussion to Linux.  LabVIEW source files, designed to be read and executed by a LabVIEW Development environment, generally have the extension ".vi".  On the other hand, if you build an executable with a LabVIEW Application Builder, the resulting file usually has the extension ".exe".  An exception is if you are building an application for a LabVIEW Real-Time system, in which case the extension is ".rtexe".  [There might also be other advanced configurations I have not yet encountered that have yet another extension ...].

 

Bob Schor

0 Kudos
Message 2 of 5
(1,572 Views)

On Unix, the extensions of files is not as important. Traditionally the file extension has no real meaning under any Unix system except as a sort of convention. Especially for executable files, the ending has no meaning at all. Instead it is a specific file attribute in adition to the read and write flag, that determines if a file is executable. It is very common to have perl, shell or other script files, which are technically simply text files, but if the executable flag is set, they can be executed. In these files the first line indicates the type of execution command to use to execute the script file. If the file is binary rather than text the system attempts to locate the executable header and if that looks valid it will start the executable file.

 

So are you talking about a built LabVIEW application executable or rather a random VI file on the system that you want to open with an installed LabVIEW instance?

 

In the first case, the built LabVIEW application is simply a real binary executable and there is no easy way to determine if it is a LabVIEW executable or some other build executable.

 

In the case of a VI file the convention is to use the vi file ending and configure your Desktop system to start-up LabVIEW for such files. How that is specifically configured depends on your Desktop manager that your distribution uses. In the case of Ubuntu you would do this: https://help.ubuntu.com/stable/ubuntu-help/files-open.html.en

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 5
(1,549 Views)

there are some files in a directroy include an  executable  binary file built by linux labview . i want to find the executable binary file and run it .

Q1 : use labview vi code , how to determine it is a  executable  binary file ?

Q2 :  if Q1 could , Can I distinguish executable files builted by labview and other tools?

0 Kudos
Message 4 of 5
(1,499 Views)
Solution
Accepted by topic author 8259

Well, the first step is to determine the file attributes of a file. The LabVIEW Get Permissions node can do that. Things are however not as simple in Unix land since a file has different access rights for the three different groups of users.

Basically the attribute is organized in three groups of three bits that define the executable(x), read(r) and write(w) access rights for the three groups: owner, group and world.

 

You can only execute a file if either:

 

-You are the user that owns the file and the x flag in the "owner" section is set

-You are a user inside the "group" for that file and the x flag in the "group" section is set

-The x flag for the "others" section is set (this is generally not recommended as it opens the system to all kinds of attacks by anonymous users trying to exploit known vulnerabilities in executables.

 

Once you have determined that a file is executable you can start it with the SystemExec function (or simply try it anyways and handle the permission error).

 

Determining if it is a LabVIEW executable or not is not really supported. There is no simple way to do that and there is no real purpose either. You can not do anything different from inside a LabVIEW VI, depending on if it is a LabVIEW built executable or not. You can only start them up through SystemExec() and nothing more.

 

You could have enabled VI server in your executable and try to connect with that. But since the VI server port can be set to any TCP/IP port number by the developer there is not trivial way to see if the VI server port is active and on which port (well there is usually a ini file alongside the LabVIEW executable that specifies the VI server port to open on startup but this can also be done explicitly in the executable itself through calling the VI server interface and then there is no external indication if there is a VI server available and on which port number.

 

So you can try to open a connection through VI server to the executable but it will fail:

 

- for non-LabVIEW executables

- for LabVIEW executables that have VI server not enabled

- for LabVIEW executables with enabled VI server listening on a different port than what you tried to connect to

 

And cycling through all 65535 possible TCP/IP port numbers is not a good option, that takes a very long time to do and it won't tell you if the executable is a LabVIEW executable or not, just that there is no VI server enabled on your system. And if you can connect, it could be the VI server of another LabVIEW application already running on your system.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 5
(1,493 Views)