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: 

write ini file not readable

Hi all,

 

I store configuration data in an ini file and give this file a custom extension.

 

If users open this file in a text editor I don't want it to be readable.  Without encrypting the text how can I do this?

 

I cant seem to get the binary VIs to work.  Maybe somebody could show me?

 

Cheers,

 

Battler.

0 Kudos
Message 1 of 11
(4,463 Views)
save the values as variant which couldnt be readable by user in notepad, see the attached file which cannot be read by user,
Message 2 of 11
(4,454 Views)
0 Kudos
Message 3 of 11
(4,453 Views)

Nice suggestion Kode.

 

As variant it is still readable, though annoying to read.

 

Any other suggestions?

0 Kudos
Message 4 of 11
(4,414 Views)

You haven't really defined how secure you want your data, but if you just want a simple way to hide the information from a casual user, this may work.

 

scramble data.png

 

Obviously, if someone really wanted to, they could figure this out.

 

steve 

 

 

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Download All
0 Kudos
Message 5 of 11
(4,409 Views)

What do you mean with "not readable"? Do you want the data to be encripted? How unconfortable shall reading data for human be?

 

Working with binary files should not be difficult. I would put all configuration data into one cluster, wire it to data input of the Write to Binary.VI  and store it to the given file. However if you have strings with your configuration data it will be readable in a plain text editor. 

0 Kudos
Message 6 of 11
(4,387 Views)

Hello battler,

 

Have you considered using the Datalog VIs?  You can find them here:

 

Block Diagram, Programming>>File I/O>>Advanced File Functions>>Datalog

 

The Datalog file is great for storing configuration data for your program.  It is a binary file so you will not be able to open it in notepad and it stores clusters as records.  Simply reading a different record entry from the file will load a different configuration.

0 Kudos
Message 7 of 11
(4,336 Views)

Nice one.  So I can use Datalog instead of ini.  I'lll try it and let you know.

 

Cheers,

 

Battler.

0 Kudos
Message 8 of 11
(4,290 Views)

The problem with datalog is it is dependent on the data type we use to create it. Suppose we create a datalog file with data type of a cluster containing a string and numeric and we wrote all the config data as clusters and stored it in a datalog file, it would be impossible for anyone to open the file without the labview program.    BUT suppose in future if the config data had to incude an enum data within the cluster, the previous datalog file would be useless. We will have to create a new datalog file with the new cluster from scratch.

 

0 Kudos
Message 9 of 11
(2,810 Views)

It's a strange request to me because the ONLY reason I would choose an ini file is so people can easily read it!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 11
(2,796 Views)