Roughly,
Open file for binary as #1
buf$ = space$(LOF(1))
get #1, , buf$
close #1
flie$ = replace$(buf$, old$, new$) ' find replace in QB64.exe code files
Open NewFile for binary as #1
put #1, , file$
close #1
' check new file
kill oldfile
name Newfile as OldFile ' EDIT: help has old and new the other way and confused me but you want the new file to have the old name.
Faster than digging around QB64 files:
Open file for binary as #1
buf$ = space$(LOF(1))
get #1, , buf$
close #1
flie$ = replace$(buf$, old$, new$) ' find replace in QB64.exe code files
Open NewFile for binary as #1
put #1, , file$
close #1
' check new file
kill oldfile
name Newfile as OldFile ' EDIT: help has old and new the other way and confused me but you want the new file to have the old name.
Faster than digging around QB64 files:
Code: (Select All)
Function strReplace$ (s$, replace$, new$) 'case sensitive 2020-07-28 version
Dim p As Long, sCopy$, LR As Long, lNew As Long
If Len(s$) = 0 Or Len(replace$) = 0 Then
strReplace$ = s$: Exit Function
Else
LR = Len(replace$): lNew = Len(new$)
End If
sCopy$ = s$ ' otherwise s$ would get changed
p = InStr(sCopy$, replace$)
While p
sCopy$ = Mid$(sCopy$, 1, p - 1) + new$ + Mid$(sCopy$, p + LR)
p = InStr(p + lNew, sCopy$, replace$)
Wend
strReplace$ = sCopy$
End Function
b = b + ...