Page 1 of 1
Posted: Mon Jul 08, 2002 10:04 am
by BackupUser
Restored from previous forum. Originally posted by Justin.
I have a buffer that contains nulls and strings, how can i search it for some strings like i would do with the string functions?
is there any way to dump the buffer to a string and use the string functions?, without writing the buffer to a file and read it to a string.
Posted: Mon Jul 08, 2002 11:19 am
by BackupUser
Restored from previous forum. Originally posted by El_Choni.
why don't you replace all the zeroes for chr(10) and then use FindString()?
Just a suggestion, bye,
El_Choni
Posted: Mon Jul 08, 2002 2:50 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
I have a buffer that contains nulls and strings, how can i search it for some strings like i would do with the string functions?
is there any way to dump the buffer to a string and use the string functions?, without writing the buffer to a file and read it to a string.
Why not try the CompareMemoryString() command?
Posted: Mon Jul 08, 2002 4:08 pm
by BackupUser
Restored from previous forum. Originally posted by Justin.
I haven't tried to replace the nulls, but i think it should be slow to peek every byte and replace it if is a null(if this is the way to do it)
i can't find any help in the Comparememorystring.
i do this to dump the buffer into a string, and don't know if it is correct:
buffer=allocatememory(0,50000,0)
start=buffer
tot.s="" ;string to hold the buffer
Repeat
st.s=PeekS(start)
len=MemoryStringLength(start)+1
start=start+len
tot=tot+st
Until start=buffer+50000
thanks for your help.
Posted: Mon Jul 08, 2002 5:18 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
I once wrote a little snippet that searched for a string in memory and then replaced this with another one, you can find this on the PB resource site
http://www.reelmediaproductions.com/pb/ it's named 'findandreplacemem'. Removing the replace part from the code shouldn't shouldn't be too hard.