And this sub is for patching FBstrings into Bstrings like: mid$(bst,mi)=fbs....
Again it is based on the previous code.
FreeBasic Source
Sub midBSTR( byval sBSTR as BSTR,byval mi as long, s as string )
dim as long i,v,le
dim as any ptr j
asm
mov eax,[sBSTR]
mov ecx,[eax-4]
mov [i],ecx
end asm
le=len(s)
v=i-mi+1 : if le>v then le=v
if le>0 then
j=strptr(s)
asm
mov edi,[sBSTR]
add edi,[mi]
dec edi
mov esi,[j]
mov ecx,[le] 'length of data
nexch:
mov al,[esi] ' src
mov [edi],al ' dest
inc esi
inc edi
dec ecx
jnz nexch
end asm
end if
end sub
Bookmarks