PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → How to copy a buffer into a structure
How to copy a buffer into a structure
Iniciado por vvido, 23,jul. 2015 16:20 - 2 respuestas
Miembro registrado
94 mensajes
Publicado el 23,julio 2015 - 16:20
I need to copy the buffer (which I receive from a socket) to a structure (all the messages are of the same type - identical structutre)
I need this to minimize the decoding work - copying the individual fields.
The strucutre contains lots of fields.

-> buf contains the message
-> myStruct is the variable of type structure (contains several fields)
Publicado el 23,julio 2015 - 17:32
Hi

"Transfer" may be what you are looking for, but it means that the
content of the buffer has to identical to the structure itself, and it
probably wont work if you have (not fixed length) strings in the structure

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Already there: WXShowroom.com, WXReplication (open source)
Coming soon: WXEDM (open source)
More information on http://www.fabriceharari.com


On 7/23/2015 8:20 AM, vvido wrote:
I need to copy the buffer (which I receive from a socket) to a structure
(all the messages are of the same type - identical structutre)
I need this to minimize the decoding work - copying the individual fields.
The strucutre contains lots of fields.

-> buf contains the message
-> myStruct is the variable of type structure (contains several fields)
Miembro registrado
94 mensajes
Publicado el 24,julio 2015 - 09:53
Thanks Fabrice !

This is EXACTLY what I needed.
Thanks for the warning. I am fully aware that the structures must match.
I am reading data from the socket and the strucutre is known in advance.