LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why writekey.vi will change my data?

When I use Writekey.vi to modify a config file, and then use close configdata.vi to save the file.

Why every key will add a spce before and after "=".

0 Kudos
Message 1 of 4
(2,184 Views)

@JohndyWu wrote:

When I use Writekey.vi to modify a config file, and then use close configdata.vi to save the file.

Why every key will add a spce before and after "=".


Just try open block diagram of 'Write Key.vi' and then open its sub-VI 'Add Key.vi'. You'll find that, adding space between is intended in this sub-VI, as shown below.

 

Add Key.vi.png


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 2 of 4
(2,173 Views)

When you open the config file the whole file is read into memory. When writing the file the whole file is written, so all keys (modified or not) will be "rewritten".

The space before and after the = as well as the empty line between sections have been introduced for better readability as far as I know.

The file will still be read correctly by older versions of the config file VIs in case you're concerned about that.

0 Kudos
Message 3 of 4
(2,156 Views)

 

OK, I understand your advise. But I try to modify this writekey.vi( add "F" to "Add Comment") and the space is add to my data also.
You also said that all the key value will be re-write when close to config file.
so I find close config data.vi, view its block diagram then find save conifg file.vi then find config to string.vi, the space write here. 
0 Kudos
Message 4 of 4
(2,129 Views)