[Feature][ZXW-65]merged P49 base code
Change-Id: I3e09c0c3d47483bc645f02310380ecb7fc6f4041
diff --git a/ap/app/msg_test/msgsnd.c b/ap/app/msg_test/msgsnd.c
new file mode 100755
index 0000000..6c5a5f0
--- /dev/null
+++ b/ap/app/msg_test/msgsnd.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+// structure for message queue
+struct msg_buffer {
+ long msg_type;
+ char msg[100];
+} message;
+main(int argc,char *argv[]) {
+ key_t my_key;
+ int msg_id;
+ int ret;
+ my_key = atoi(argv[1]); //create unique key
+ msg_id = msgget(my_key, 0666 | IPC_CREAT); //create message queue and return id
+ printf("Message id: %d\n", msg_id);
+ message.msg_type = 1;
+ printf("Write Message : ");
+ fgets(message.msg, 100, stdin);
+ ret = msgsnd(msg_id, &message, sizeof(message), 0); //send message
+ printf("Sent message ret is %d message is : %s \n", ret, message.msg);
+}