Hi,
I'm reading in a configuration file that can support comments. Currently, I'm parsing the file so that if a ! character (comment indicator) is reached then I just skip the line, or skip what comes after it, sort of like a C/C++ compiler. Here's an example of the config file:
#SECTION1
! comment
data1 ! comment
! comment
#SECTION2
!comment
data2
! comment
Well, that's how the configuration file is designed and # means a section header. The user has an option of reading in this file, and through a GUI, save this file, with the changes, to another file. However, I've only gotten to the point where the output of this file only shows the changes to the data, but the comments are lost.
So my question is: Is there a way to retain the comments so that the comments show if the configuration file is saved somewhere else?
Thanks, any help is appreciated.
I'm reading in a configuration file that can support comments. Currently, I'm parsing the file so that if a ! character (comment indicator) is reached then I just skip the line, or skip what comes after it, sort of like a C/C++ compiler. Here's an example of the config file:
#SECTION1
! comment
data1 ! comment
! comment
#SECTION2
!comment
data2
! comment
Well, that's how the configuration file is designed and # means a section header. The user has an option of reading in this file, and through a GUI, save this file, with the changes, to another file. However, I've only gotten to the point where the output of this file only shows the changes to the data, but the comments are lost.
So my question is: Is there a way to retain the comments so that the comments show if the configuration file is saved somewhere else?
Thanks, any help is appreciated.