I'm trying to change the last character in a line in a file (Opened using OpenFile and pointed to by the variable "Chainsaw") from a 0 to a 1
At first I tried using WriteString, however this insited on writing boxes after the line in question, I'm guessing this is some sort of special character that denotes it as a String Variable
So I resigned to use WriteLine and redundantly re-writing the entire line
I have the line stored in "RLine" and the position of the cursor is at the beggining of the line just after that
I'm using the Print statements to keep track of the file positions as the code runs
The problem is, that the above code doesnt do anything, the line appears in the file exactly as it did before running it
The cursor positions print as:
25
11
25
So the WriteLine command is at least moving the cursor forward as it should do
But it isnt writing the modified line, its writing the old one, or isnt actualy writing at all
It simply doesnt make any sense to me
At first I tried using WriteString, however this insited on writing boxes after the line in question, I'm guessing this is some sort of special character that denotes it as a String Variable
So I resigned to use WriteLine and redundantly re-writing the entire line
I have the line stored in "RLine" and the position of the cursor is at the beggining of the line just after that
Print StreamPos(Chainsaw) SeekStream(Chainsaw,StreamPos(Chainsaw)-(Len(RLine)+2)) 'Move the stream position back the length of the line, plus an extra 2 for the "new line" character Print StreamPos(Chainsaw) RLine = Left(RLine,Len(RLine)-1) 'Chop the last character (0) off of RLine RLine = RLine + "1" 'Replace it with a 1 WriteLine(Chainsaw,RLine) 'Write the line back again Print StreamPos(Chainsaw)
I'm using the Print statements to keep track of the file positions as the code runs
The problem is, that the above code doesnt do anything, the line appears in the file exactly as it did before running it
The cursor positions print as:
25
11
25
So the WriteLine command is at least moving the cursor forward as it should do
But it isnt writing the modified line, its writing the old one, or isnt actualy writing at all
It simply doesnt make any sense to me