private sub tihuan(tfilepath as string,oldstr as string, newstr as string)
dim k() as byte
open tfilepath for binary as #1
redim k(filelen(tfilepath)-1)
get #1, , k
close #1
k=replace( mid(strconv(k,vbunicode),1,len(strconv(k,vbunicode))-1) _
,oldstr,newstr) '无条件全部替换
open tfilepath for output as #2
print #2, k
close #2
end sub
'看你的代码完全是字符处理,所以可以这样:
private sub tihuan(tfilepath as string,oldstr as string, newstr as string)
dim s as string
open tfilepath for binary as #1
s=space(lof(#1))
get #1, , s
close #1
s=replace(mid(s,1,len(s)-1),oldstr,newstr) '无条件全部替换
open tfilepath for output as #2
print #2, s
close #2
end sub