views:

257

answers:

1

I want to replace the file 1.txt with its original contents except the line in R1, for which I wrote the following code:

FileOpen $0 "1.txt" "r"                     
GetTempFileName $R0                         
FileOpen $1 $R0 "w"                        
loop:
    FileRead $0 $2                         
    IfErrors done                          
    strcmp $R1 $2 loop here
    here:                                  
       FileWrite $1 $2                     
       Goto loop
done:
    FileClose $0                                    
    FileClose $1
    Delete "1.txt"
    CopyFiles /SILENT $R0 "1.txt"
    Delete $R0

But its not working properly, it keeps 1.txt as it is. Can somebody please help me to find out where is the problem?

A: 

I have just ran into the same problem. Fixed it by inserting a ClearErrors command before "loop:"

James