11-16-2010 05:55 AM
Hi, everyone
For my project it is required that a parameter file is read at the beginning, in order for certain variables to be initialized with specific values that change with the user.
At the moment, the way it is done is the following: The values at a specified sequence in a text file are read and saved in an array and the elements of the array are retrieved according to their index.
The problem with this implementation is, that if for some reason the format of the file changes, e.g. we want to use a parameter file from a previous version of the program that has the values for the same variables but in a different order, the only way to have the right values for the parameters is to change everything accordingly, which is really time wasting.
Could someone suggest a different implementation that would make the reading of the different values independent from their order in the file, e.g. by scanning the file for specific strings and reading the value after the string?
Thank you very much.
P.S. I have attached a screenshot of the routine I am using now.
Solved! Go to Solution.
11-16-2010 06:23 AM
Hi panagiov,
Find attached Folders.
Method 1: in this you can search for each variable separately. You can use "Config file vis" to get all keys(Variables) at once and then you can use for loop to get their values. Or you can access individual values as shown in this code.
Method 2: here you will get all data at once. You will get Variable and Data (2D array) You need to search variables as and when required.
I hope you will understand these methods.
Best of luck
11-16-2010 07:48 AM
Thank you so much!!!