No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

message.cpp 759B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. #include "message.h"
  7. void set_msgToMon_header(MessageToMon *msg, char *header) {
  8. memcpy(msg->header, header, sizeof (header));
  9. }
  10. void set_msgToMon_data(MessageToMon *msg, void * data) {
  11. if (msg->data != NULL) {
  12. free(msg->data);
  13. }
  14. msg->data = malloc(sizeof (data));
  15. memcpy(msg->data, data, sizeof (data));
  16. }
  17. void free_msgToMon_data(MessageToMon *msg) {
  18. if (msg->data != NULL) {
  19. free(msg->data);
  20. }
  21. }
  22. void print_msgToMon(MessageToMon *msg) {
  23. printf("header: %s\n", msg->header);
  24. printf("data: %s\n", (char*)msg->data);
  25. }