Posts: 8
Registered: ‎03-09-2017
Accepted Solution

Buffer problem WF121A - Bgscript



I have a problem with buffers.

I have initialized a buffer at the start of the script:   dim datatosend (8)

after at the event "system_boot" I use this buffer and I fill it with this code:    datatosend(0:8) = "Prova123"


When I try to use this buffer (for example reading it by USB endpoint with Bluegiga GUI - this is the command; call endpoint_send(3, 8, datatosend(0)),

only the first 4 bytes are filled with "Prov" the other bytes starting from the 4th byte are filled with \x04 \x00 \x00 \x00.


I try to use memcpy and other solution, but I reach the same result.



Have I made a mistake?

Thank you

Posts: 8
Registered: ‎03-09-2017

Re: Buffer problem WF121A - Bgscript

After a deep-Search acitvity in the forum I have found the solution here:


My mistake is to call the command:

endpoint_send(3, 8, datatosend(0))

instead of this one:

endpoint_send(3, 8, datatosend(0:8))


Thank you