Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sys/types.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #include <stdlib.h>
- #define MAX 10
- main(){
- int shmid, i;
- char *buf;
- shmid = shmget(45281, MAX*sizeof(int), IPC_CREAT|0600);
- if (shmid == -1){
- exit(1);
- }
- buf = (char*)shmat(shmid, NULL, 0);
- if (buf == NULL){
- exit(1);
- }
- while(1){
- for (i=0; i<5; i++)
- buf[i] = 'a';
- }
- for(i=0; i<5; i++)
- buf[i] = 'b';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement