12-21-2017 05:52 AM
Hello everyone,
I am designing an application where it will be helpful to get the information of a control from a .ctl file. I would like to use this information to later typecast some variant information.
Any clue on that?
Thanks in advance!
12-21-2017 05:58 AM
12-21-2017 07:42 AM
Hi GerdW,
The idea is that I have in a text file with something like this:
function_name(variable1, variable2)
This not C, it is something else designed long ago that we have to import somehow. There are several defined functions that should be interpreted and I already have one typedef control to allocate the function input data. Now it is necessary to convert the strings into the specific data. With numeric variables is quite easy to do. The problem is with enums. Depending on the function_name it is possilbe to have the corresponding cluster in variant format. From it, it is possible to know which is the ctl that contains the enum definition. Then I would like to use this ctl to somehow typecast the enum. Right now is the more automatic way that I can foresee but I don't know the exact way to do it.
Any help will be appreciated.
Best regards,
cgh
Best regards,
Carlos
12-21-2017 08:06 AM
Hi Carlos,
to typecast "something" into an enum you need to know that enum in advance…
Depending on the function_name it is possilbe to have the corresponding cluster in variant format.
When you know the "cluster" format (I thought you were talking baout enums?) then you can create a VI doing the needed conversion without needing to "parse" some ctl files! I still don't get what you really want to achieve…
12-21-2017 08:09 AM
There are multiple ways to do this, and before I start with an example on how to parts .ctrl files, or showing scripting examples, or showing the Variant Data Parsing Palette, I too would like to know what information you want, and to see some example of how the data is coming in. Is this in a running VI? Will this be in an EXE? Will LabVIEW be used at all?
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
12-21-2017 08:09 AM
I am not sure if I understand exactly what you are trying to do...
This Nugget talks about how to use control references to explore an undefined control type.
If you are just looking to get the string that goes with a enum then "format into string" will work.
There are also function under the variant>>> Data type parsing palette that may be of interest to you.
Ben