PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Quick conversion array to buffer
Quick conversion array to buffer
Iniciado por guest, 27,ene. 2015 10:04 - 3 respuestas
Publicado el 27,enero 2015 - 10:04
I use some HTTP API that outputs raw image data as response on web request. The result is array of bytes (array of 1-byte unsigned int). I use .Net stream to read data. I need to display result image on Image control so I need to convert result array into Buffer. Now I use the simple algoryhtm:

// get the image raw data
arrBytes is array of [1024] 1-byte unsigned int
BufferedStream.Read(arrBytes,0,1024)
// convert array to buffer byte per byte
bufBuffer is Buffer
FOR nByte in arrBytes
bufBuffer += Charact(nByte)
END

But the little problem is slow process. As bigger array as longer process is going. 40Kbytes are processed about few seconds but when I get array more then 1Mbyte (HD image) the process is "hangs". Could you someone help me?
Publicado el 27,enero 2015 - 10:47
Hi

You can try using "transfer" instead of your copy by byte, that should be much faster...

Best regards
Publicado el 27,enero 2015 - 11:26
Quote
Fabrice Harari

You can try using "transfer" instead of your copy by byte, that should be much faster...

Thank you for your answer. I tried so

bufBuffer is Buffer arrArray is array of 1-byte unsigned int Transfer(&bufBuffer,&arrArray,arrArray..Occurence) and I have got an error:

Bad destination address (0x00000000 on 23904 bytes). It does not match a valid memory address in write mode.

P.S. I also tried to use string instead Buffer .
Miembro registrado
67 mensajes
Publicado el 27,enero 2015 - 12:20
Hi

Could you perhaps save the array to a file and load the file to into the buffer using floadbuffer() to speed it up?

Gautam