Talk:Update a configuration file: Difference between revisions

 
Line 49:
 
== A generic solution for the problem ==
 
Well, as I saw in the previous comments, the task was really complex. And it could be, so I did a generic solution for the problem:
 
1)# The solution in BASIC (QB45) reads ANY configuration file and shows what it found.
2)# If there is an array (FAMILY John Smith, Lisa Smith, Charles Smith) the program will create an array of elements FAMILY.
3)# If FAMILY variable is repeated in another part of the configuration file, will simply add the found elements to the existing array.
4)# The main procedure can toggle the comment status of a variable in the configuration file as per User request.
5)# The main procedure will save all the elements of an array in just one line. This way, if you have a situation like this:
#:
 
#:FAMILY John Smith, Lisa Smith, Charles Smith
#:FRUITSILIKE banana
#:FAMILY Donna Smith
#:FAMILY Rachel Smith
#:
 
#:Will end as follows:
#:
 
#:FAMILY John Smith, Lisa Smith, Charles Smith, Donna Smith, Rachel Smith
#:FRUITSILIKE banana
#:
 
6)# The main procedure is able, when saving, to record the variables and values with a "=" or with a space (" ") in between. The configuration file reader can identify both of them.
7)# The program can identify if a variable name is an array or not, and, if so, to return the number of elements in the array.
8)# The above explained functionality lead to a very large program. Nevertheless, as per my understanding, it amply meets the requirements of the task.
Anonymous user