cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
saikrishna_r
Level 2

How to update a particular string value in a file

Hi all,

I need to check a particular string value in a file and then update that string value as per my requirement.
For Example:
In a file, sample=0 is there, Now i want to search for sample value and if it's value is zero then i want to change that value to 1.

Please let me know the functions useful for implementing this.

Regards,
Sai
Labels (1)
0 Kudos
(1) Reply
Flitskikker
Level 4

Is there a header like [Blabla]?
Then it looks like an INI file to me, for which you have some built-in functions:

GetProfString ( szFileName, szSectionName, szKeyName, svResult );
WriteProfString ( szFileName, szSectionName, szKeyName, szValue );

szFileName:your file
szSectionName: Blabla if the header is [Blabla]
szKeyName: sample
0 Kudos