Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Data Structure

 
Isaias C. Barroso
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I need to transfer the follow Data Structure for to a Socket with J2ME
Structure in C
typedef struct data_outboundrec
{
unsigned long intcnumber;
unsigned chardevice_id[20];
unsigned char data[255];
unsigned intdatasize;
} DATAOUTBOUND_REC;
how to make this.
Thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would do that by creating a byte[] and writing methods to fill/extract each of the variables. That way you have total control over ended-ness.
Transmitting / reading a byte[] is just one call.
Bill
 
Isaias C. Barroso
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!