Reputation: 669
What would be a best and simple way of storing incoming message from different processes in an array in C? I was thinking to have an array MQ but also need to store message sequence numbers and process ids for each incoming message. Thanks.
Upvotes: 0
Views: 175
Reputation: 76660
It sounds like you want to have an array of structures that contain the various elements that you want to store, e.g.
struct MessageInfo {
int message_id;
pid_t incoming_pid;
char message_data[MAX_MESSAGE_LEN];
};
struct MessageInfo message_queue[MAX_QUEUE_LEN];
Upvotes: 3