title: Run Shared Memory program on cygwin
body: <p>I have tried to run the following code on cygwin in windows; there will be no compilation errors in it but when I tried to run it I have <strong><em>Bad system call (core dumped)</em></strong> error.</p>
  
  <pre><code> #include &lt;sys/types.h&gt;
   #include &lt;sys/ipc.h&gt; 
   #include &lt;sys/shm.h&gt; 
   #include &lt;stdio.h&gt; 
   #include &lt;stdlib.h&gt;
   void main ( ) 
   { int shm_id; key_t mem_key;
   int *shm_ptr; 
   mem_key = ftok(".", 'a'); 
   shm_id = shmget(mem_key, sizeof(int), IPC_CREAT | 0666);
   if (shm_id &lt; 0) 
   { printf("*** shmget error (server) ***\n");
   exit(1);
   }
   shm_ptr = (int *) shmat(shm_id, NULL, 0); 
   /* attach */ 
   if ((int) shm_ptr == -1) 
   {
   printf("*** shmat error (server) ***\n");
   exit(1);
   } 
  }
  </code></pre>
  
  <p>Why I have this error? Can I solve it?</p>
  
  <p>Thanks a lot.</p>