LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to file Question

Solved!
Go to solution

smercurio_fc wrote:

Mark Yedinak wrote:

smercurio_fc wrote:
An alternative is to just use XML format. You can use the LabVIEW XML schema by using the Flatten to XML/Unflatten from XML functions. They're in the string palette.

While XML is convenient I find that if the configuration file needs to be modified externally by the user XML can be a pain to work with. It is easier if the editor supports XML and parses the data for you but it is a pain to work with in its raw form. Old style ini files in my opinion are easier to work with with a basic text editor.


I use Notepad++ with the XML editor plug-in. Makes working with XML much easier. Smiley Wink

 

I don't have anything against ini files - just offering an alternative. 


I have nothing against XML either. I just wanted to make the OP aware of everything so they can make an informed decision. I know that people can sometimes hear XML (or any new technology) and assume that it is better since it is new. Some old ways of doing things have persisted because they work well.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 11 of 33
(964 Views)

Well, 

 

At this point I am not very familliar with either.  I think I played with some xml in notepad++ a while back as a method to create mods for a video game Smiley Tongue but never in LV.

 

I am going to work on the ini version, as I think I have a conceptual handle on that method (Thanks Mark!)

 

Now, if I could just get the rest of my job to leave me in peace long enough to make it happen!

0 Kudos
Message 12 of 33
(960 Views)

How do I know (and do I even care) what the ini file name is, and where it is saved?

 

Is that the refnum input?


And is there a way to delete sections if needed?

Message Edited by krwlz101 on 03-24-2010 10:42 AM
0 Kudos
Message 13 of 33
(954 Views)

Haha, guess I didn't have a handle on this.  What should I be putting into the refnum input?

 

Message Edited by krwlz101 on 03-24-2010 11:00 AM
0 Kudos
Message 14 of 33
(946 Views)

OK,

 

So I have some of that stuff figured out (like the refnum).  Why now am I getting a warning about conflicting dependencies when I add the "read section" vi to my project?

0 Kudos
Message 15 of 33
(924 Views)
What is "read section"? We have no idea what you're doing without seeing some code ...
0 Kudos
Message 16 of 33
(923 Views)

Sorry, read section is the...  well "Read Section Cluster" from the openg ini config files pallette.

 

Either way, here is what I've got.  I changed over to an event structure, and I have not had enough time to really contemplate this stuff today (hence all the short questions that I could then answer myself).

 

I'm finding the only bummer about OpenG functions is that they don't include example problems!

 

0 Kudos
Message 17 of 33
(919 Views)
First, I would put the name of your config file into a shift register so that you can use it in all of your various events. You also need to supply a complete path with file name. I would also make your clusters typedefs and use the typedef. I noticed a build cluster with no typedef or cluster type provided. This generally means you will eventually break your code when you change the definition of the cluster and forget to update all references to it. That is exactly what typedefs are meant to do.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 18 of 33
(915 Views)
I understand the concept of type defing, and why I would want to do so.  What I was running into is that I have no need to display all the data again, and nor did I want to use the cluster in my front panel, for asthetic reasons.  I guess I  might go that way anyway, since it does seem to make the data side easier.
0 Kudos
Message 19 of 33
(897 Views)

Here is the partially updated.


Seems like the save to file function is working (kind of).  When I open the ini file in notepad, I see no text.  When I use the load function button, no matter what section reference I put in, it seems to load the last set of data.  

 

Not quite sure where I'm going wrong.

0 Kudos
Message 20 of 33
(891 Views)