Replace value in a file
Posted on 2004-12-01
Ok, I have a .ini file with values, there is a certain section that I need to manipulate the values of in the file.
For instance, I have this block of parameters and values in the file (not there is still text before and after this, I am just focusing on this section)
; Battery Manager Configuration Section.
; - StringSetup parameters are:
; StringCharger ('0' for Silcon or '1' for Other),
; - Units for temperature will be first 'C' or 'F' found on line.
; If 'C' or 'F' not specified, current NMC preference is used.
; - Calibration items are not to be mass configured so not listed.
WebRefresh=1 (0 to 10 Minute(s))
AlarmResetMode=0 (0 to 1)
BatteryChemistry=0 (0 to 1)
StringSetup="1 (1 to 2), 40 (1 to 400), 1, "
BatteryAHCapacity=100 (100 to 2000)
BalanceBoostTime=3 (3 to 10 Second(s))
CellVoltageLimitMinMax=2.150, 2.400 (2.000 to 2.500 V)
PilotTempLimitMax=95.0 F (85.0 to 120.0 F)
AmbientTempLimitMinMax=50.0, 95.0 F (50.0 to 120.0 F)
ResponseDeviationAlarmLevel=20 (10 to 20 %)
DischargeDeviationAlarmLevel=15 (5 to 20 %)
RippleCurrentAlarmLevel=5 (0 to 2000)
Now, I need to go in and change the value for say: AmbientTempLimitMinMax
it has 2 values that need to be changed.
How would you go about opening this file and chaning just the values for that line?
Thank you very much for your time.