Jump to content

(Semi)Automatic Type Conversion


Recommended Posts

Dear all,

today I started this topic (unfortunately wrong under "User Interface"):

I am looking for a possibility to

- read out a (linux-like) config file (comments start with #, value01 = abc, etc) --> DONE

- isolate usable lines (value01=abc) --> DONE

- parse this content to a "configcluster" --> OPEN

I have defined this configcluster as typedef. Now I want to connect this cluster to a function/VI that searches inside the usable lines (it's a string) for the names of the elements, gets the value behind the name, convert it to the type the element inside the cluster represents and inserts it into the cluster. I have the openG data Tools in use - perhaps I have overseen a simple solution?

This is an alternative to the LV-config-file VIs, in my opinion their use is rather unconvenient (and also this automatism is missing).

The advantage of my effort should be, that I can easily change/enlarge my configcluster(typedef) without applying changes to the readout-and-parsing-functionality.

I already got one interesting reply:

Take a look here

http://www.mooregood...iteAnything.htm

This does read/write to ms style config style VI's (not the linux style config VIs) but you can get a lot of insight about how something like you are proposing might be structured. In my opinion, this set of VI's pretty much solves the problem of easy to read, write, and create config files. I've used them quite a while with no problems.

I also use the LabVIEW XML schema a lot but not where I expect the configs to be edited in a text editor

Mark

Now I made a lot of progress, I produced a solution that does what I expect. As I am not fully experienced I share the code and ask all interested readers/programmers to take a look at it, perhaps improve it, give me some hints and use it! I all packed into a LV8.6-project, let me know, if I should give some more information.

Martin

PS: As I didn't attach the example config-file, it is here:

# System config-file# This file is equivalent to a Linux-like config-file.# Comments behind a # are ignored.# Values are identified by '='# Example:## Value01 = 123### Boolean values may be 0 and 1 or 'true' and 'false' without ''loglevel = 441logfilepath = c:\logssyslogserver = 127.0.0.1syslog_localport = 234basepath = d:\basepath

parseconfig_8.6.zip

Edited by mstoeger
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.