locked
How can i update a config file with certain values ? RRS feed

  • Question

  • User1253338400 posted

    Hi,

    I have a config Object like ConfigObject and the filed members are 

    field 1, filed 2, field 3 , field 4 , field 4, field 5,field 6, field 7 and they are all strings.

    Now when i only want to update 1 or 2 fileds at certain times.

    At the moment i read the whole config file get the values and only update the required values and then write it back.

    Is there a way i can directly update only the fields instead of reading , saving and then writing back ?

    thanks

    Wednesday, July 8, 2020 11:27 AM

Answers

  • User-474980206 posted

    if the replacement strings where the exact same length as the old strings, then you could do a disk update in place, otherwise you need to write out a new file.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 8, 2020 4:05 PM

All replies

  • User-474980206 posted

    if the replacement strings where the exact same length as the old strings, then you could do a disk update in place, otherwise you need to write out a new file.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 8, 2020 4:05 PM
  • User1253338400 posted

    thanks , i didnt consider that.  They arent the same length, so i do need to write out a new file. 

    Wednesday, July 8, 2020 10:51 PM