How do I append bytes in memory?
Posted: Wed Feb 16, 2005 5:11 am
Hello and thank you for reading. I begin with this code:
That code will read all the data from the website and put it in the *buffer until bytes_read = 0 (there is no more data to be read from the catch).
What I need to do is find a way to put the byte fragments of *buffer together into a single *pointer so i can use CatchImage(#Image, @Appended_Buffer).
I have tried everything I know from this:
To this:
This too:
And finally this:
Mind you, NONE of the above code snipplets work. I have been at this for 2 days with no results! I am starting to think there is no way to put bytes of data together in memory. If you are already thinking about suggesting to write the data to a file, that is out of the question, I want to work directly in memory. PLEASE, anyone..If you know how to accomplish what I am doing, tell me what I am doing wrong.
Thanks in Advance,
DARKGirl
Code: Select all
*Buffer = AllocateMemory(1024)
bytes_read.l
Repeat
Delay(10)
InternetReadFile_(HOR_Handle, *Buffer, 1024, @bytes_read)
Until bytes_read=0
What I need to do is find a way to put the byte fragments of *buffer together into a single *pointer so i can use CatchImage(#Image, @Appended_Buffer).
I have tried everything I know from this:
Code: Select all
*Buffer = AllocateMemory(1024)
bytes_read.l
*RealBuffer = 0
old_bytes_read.l = 0
Repeat
Delay(10)
InternetReadFile_(HOR_Handle, *Buffer, 1024, @bytes_read)
If old_bytes_read = 0
*Temp_Buffer = 0
Else
*Temp_Buffer = AllocateMemory(old_bytes_read)
EndIf
If *RealBuffer <> 0
CopyMemory(*RealBuffer, *Temp_Buffer, old_bytes_read)
FreeMemory(*RealBuffer)
EndIf
*RealBuffer = AllocateMemory(bytes_read + old_bytes_read)
old_bytes_read = bytes_read
CopyMemory(*Buffer, @RealBuffer, bytes_read)
FreeMemory(*Temp_Buffer)
FreeMemory(*Buffer)
*Buffer = AllocateMemory(1024)
Until bytes_read=0
Code: Select all
*Buffer = AllocateMemory(1024)
bytes_read.l
total_bytes = 0
Repeat
Delay(10)
InternetReadFile_(HOR_Handle, *Buffer, 1024, @bytes_read)
*total = AllocateMemory( total_bytes+bytes_read )
CopyMemory( @Buffer, (@*total)+bytes_read, bytes_read )
total_bytes + bytes_read
FreeMemory(*total)
Until bytes_read=0

Code: Select all
*Buffer = AllocateMemory(1024)
bytes_read.l
*RealBuffer = 0
total_bytes.l = 0
Repeat
Delay(10)
InternetReadFile_(HOR_Handle, *Buffer, 1024, @bytes_read)
strinf.s = PeekS(*Buffer)
Debug stringf.s
Stringl.s + stringf.s
Debug Stringl.s
Until bytes_read=0
*Buffer = Val(Stringl.s)
Code: Select all
*Buffer = AllocateMemory(1024)
bytes_read.l
*RealBuffer = 0
total_bytes.l = 0
Repeat
Delay(10)
InternetReadFile_(HOR_Handle, *Buffer, 1024, @bytes_read)
*RealBuffer = ReAllocateMemory(*RealBuffer, total_bytes + bytes_read)
CopyMemory(*Buffer, @RealBuffer, bytes_read)
total_bytes + bytes_read
Until bytes_read=0
Thanks in Advance,
DARKGirl