mirror of
https://github.com/Hizenberg469/Inter-Process-Communication-IPC-.git
synced 2026-04-19 18:02:24 +03:00
26 lines
488 B
C
26 lines
488 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
extern int
|
|
read_from_shared_memory(char* mmap_key,
|
|
char* buffer,
|
|
unsigned int buff_size,
|
|
unsigned int bytes_to_read);
|
|
|
|
int
|
|
main(int argc, char* argv[]) {
|
|
|
|
char* key = "/introduction";
|
|
char read_buffer[128];
|
|
memset(read_buffer, 0, 128);
|
|
|
|
int rc = read_from_shared_memory(key, read_buffer, 128, 128);
|
|
if (rc < 0) {
|
|
printf("Error reading from shared memory\n");
|
|
return -1;
|
|
}
|
|
|
|
printf("Data read = %s\n", (char*)read_buffer);
|
|
|
|
return 0;
|
|
} |