some-usable-scripts/c/libipc/print-bytes.c
Philippe PITTOLI e9576b5574 adding C tests
2020-01-28 12:41:11 +01:00

28 lines
489 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <ipc.h>
int main(int argc, char * argv[])
{
SECURE_BUFFER_DECLARATION (char, buffer, 4096);
uint32_t msize = 0;
char *message = "coucou";
if (argc == 2) {
message = argv[1];
}
msize = ipc_message_raw_serialize (buffer, 2, 42, message, strlen(message));
write (1, buffer, msize);
fflush (stdout);
// to wait for a response
sleep (1);
return EXIT_SUCCESS;
}