I am getting an error when I use the code like the one below, any help?
All I wanted to do, find and replace some characters in data.xml file.
But, multiple characters.
Master.ini file contains following;
Find=&
Replace=&
Find='
Replace='
Find="
Replace="
Find=°
Replace=°
Find=–
Replace=
----------------------------------------------------------------------------------------------
Winbatch code is following;
R = FileOpen("Master.ini", "READ")
Find = ""
Replace = ""
while @TRUE
x = FileRead(R)
l = StrLen (x)
If x == "*EOF*" Then Break
if StrSub(x ,1,5) == "Find=" then Find = StrSub(x,6,l-5)
if StrSub(x ,1,8) == "Replace=" then
Replace = StrSub(x,9,l-8)
str=Find
rep=Replace
dafile="C:\expodata\data.xml"
fs = FileSize( dafile )
binbuf = BinaryAlloc( fs+2048 )
ret = BinaryRead( binbuf, dafile )
num = BinaryReplace( binbuf, str, rep ,0)
;Message( "Number of '%str%' strings replaced", num )
BinaryWrite( binbuf, dafile )
BinaryFree( binbuf)
EndIf
EndWhile
FileClose (R)