C: data problem in a struct

Status
Not open for further replies.

alsig

Junior Member level 1
Joined
Jan 17, 2005
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
160
Hi,
I have an embedded system which runs FreeRTOS. I have several applications on top of FreeRTOS and one of them is a message parser. All messages that needs to be sent between the different application have to go through the message parser application.

My problem is the the data varies depending on the which applications communicates and i want to use the same message structure for all the applications. Sometimes the data are simple like chars and ints and other times the data is a struct.

Regards Jens Alsig
 

Ever heard of a union?
Code:
struct msg_ {
  int commonfield;
  union context_ {
    int sharedfield1[16];
    char sharedfield2[64];
  } context;
} msg;
 

    alsig

    Points: 2
    Helpful Answer Positive Rating
Ever heard of a union?
Now I have
Thank you, checkmate

Regards Jens Alsig
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…