Advertisement
Guest User

wczytuje

a guest
May 24th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <sys/types.h>
  2. #include <sys/ipc.h>
  3. #include <sys/shm.h>
  4. #include <stdlib.h>
  5.  
  6. #define MAX 10
  7.  
  8. main(){
  9. int shmid, i;
  10. char *buf;
  11.  
  12. shmid = shmget(45281, MAX*sizeof(int), IPC_CREAT|0600);
  13. if (shmid == -1){
  14. exit(1);
  15. }
  16.  
  17. buf = (char*)shmat(shmid, NULL, 0);
  18. if (buf == NULL){
  19. exit(1);
  20. }
  21. while(1){
  22.  
  23. for (i=0; i<5; i++)
  24. buf[i] = 'a';
  25.  
  26. }
  27. for(i=0; i<5; i++)
  28. buf[i] = 'b';
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement