Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Write a Byte Array to a MemBlock

Author
Message
snaidamast
5
Years of Service
User Offline
Joined: 16th Oct 2018
Location:
Posted: 7th Sep 2023 21:03
Hello...

Does anyone know how to write a byte array into a memblock???

I would be using this technique to load my images from database records that would be storing them as binary objects.

Thank you...

Steve Naidamast
Sr. Software Engineer
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 8th Sep 2023 13:47

You'd need to create a memblock; then in it's simplest form you'd run through and set the bytes in the mem block...

eg;
for lp =0 to Number_Of_Bytes
SetMemblockByte( memID, lp , MyArray[ lp ] )
next


PlayBASIC To HTML5/WEB - Convert PlayBASIC To Machine Code
snaidamast
5
Years of Service
User Offline
Joined: 16th Oct 2018
Location:
Posted: 8th Sep 2023 15:44
Thank you, Kevin...

Looking at the documentation that is the conclusion I came to.

However, that is quite inefficient for any sized Byte array. As a result, I was looking to avoid doing that.

I am surprised that the engine does not allow for memory-streams so that images can be stored in a database.

Steve Naidamast
Sr. Software Engineer
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 8th Sep 2023 23:37
You can set up a dynamic write for memory blocks, but it is not a very efficient thing as far as I know...

https://forum.thegamecreators.com/thread/228470
Automation on Steam now!
Score Table Jr. on Google Play!

Login to post a reply

Server time is: 2024-04-27 23:04:24
Your offset time is: 2024-04-27 23:04:24