wood burning stoves*
The moose likes Java Micro Edition and the fly likes Data Structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Data Structure" Watch "Data Structure" New topic

Data Structure

Isaias C. Barroso
Ranch Hand

Joined: Jan 22, 2002
Posts: 165
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;
how to make this.

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
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.
Isaias C. Barroso
Ranch Hand

Joined: Jan 22, 2002
Posts: 165
It is sorta covered in the JavaRanch Style Guide.
subject: Data Structure
Similar Threads
Header from network packet
Data Structure Transfer
Data Structure
Is Java has any unsigned words??
How to read a C++-struct-constructed Binary Data