Writing on a specific line is complicated because all data in the file is sequential. This means that the following line immediately follows the 0.5 (in your example) part of the file. You could edit the file by using OpenFile and then SeekFile'ing to the desired byte, WriteByte'ing the desired byte(s), and then Closefile. Unfortunately if the number of bytes you write are shorter or longer than the bytes already there, you will mess up the file.
What I am getting at is that if you were to replace 0.5 with 0.8 for example, then there would be no problem. BUT, if you were to replace 0.5 with .5 or 0.83 then funny things would happen. .5 would actually become .55 and 0.83 would become 0.83 but the three would write over the first character of the next line which would make your gamma= statement equal everything on the following line as well.
In this example < will represent line feed character
previousline<gamma=0.5<followingline
;changed to 0.8 would be
previousline<gamma=0.8<followingline
;just what you want
previousline<gamma=0.5<followingline
;changed to .5 would be
previousline<gamma=.55<followingline
;extra 5 wasn't erased
previousline<gamma=0.5<followingline
;changed to 0.83 would be
previousline<gamma=0.83followingline
;line feed character erased so now gamma = 0.83followingline
So what you would need to do if you want line by line editability is use the SeekFile and FilePos commands to:
-find the spot that requires changing by parsing through the file until you find the phrase your are looking for (such as "gamma")
-note the FilePos where you found the phrase
-store everything before that spot (FilePos) in a string variable (say Beginning$)
-store everything after that spot in another string variable (say Remainder$)
-overwrite the entire file with: Beginning$ + "0.83" + Remainder$
***Alternative method***
Another method you could implement would be to structure your file in such a way that you don't use variable length lines. Every line in your file is exactly the same length so you can easily change any line and know that you won't overwrite anything else. You could have a structure something like this:
variablename = floatingpointvalue
AAAAAAAAAAAA=XXXXXXX.XXXXXX
gamma = 0.5
volume = 75
zoffsetvalue= 45903.239594
xoffsetvalue=1003478.002
This way if you wanted to change any given value (say the volume percent to 80), you could just skip to the second 'line' by
SeekFile'ing to (2 - 1) times 27(the linelength) plus 13(offset to value part of the line)
and WriteByte'ing the characters
" 80 "
(exactly 14 characters long) (NOTE that you wouldn't actually write the quotes, they are just there for clarity)
The downfall to this method is that if a user were to modify the file and change the structure in any way, it would become corrupted.
So, the safest bet is to use the first method. The easier way is to use the second method.
Note that these two methods are not the only ways either.