[Hdf-forum] How to write a structure with a fixed size array (allocated dynamically) to a packet table then how to read it back

Herrero Vincent vherrero at sopragroup.com
Fri Jan 22 05:09:10 EST 2010


Hello;
 
I would like to create a Packet Table (FL) with following datatype:
 
int size = 128;
typedef struct MyStruct {
 long long date;
 int len;
 unsigned short *buffer;
} MyStruct;
 
MyStruct s1; // structure for writting
MyStruct s2; // structure for reading
 
s1.date = 12345678912;
s1.len = size;
s1.buffer = (unsigned short*)malloc(size*sizeof(unsigned short));
for (n = 0; n < size; n++)
{
 s1.buffer[n] = (unsigned short) n + 1;
}
 
How to write this structure to packet table fixed length?
Then how to read data back from the packet table into the s2 structure?
 
Thanks for your help!
Regards,
 
Vincent Herrero
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.hdfgroup.org/pipermail/hdf-forum_hdfgroup.org/attachments/20100122/e5785b17/attachment.html>


More information about the Hdf-forum mailing list