#include #include #include #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { int key; int msize; char *shm; int shmid, count=0; if(argc==3) { key=atol(argv[1]); printf("key=%d\n",key); msize=atoi(argv[2]); printf("Size=%d\n",msize); } else { printf("Not enough args\n"); exit(-1); } // connect to the shared memory shmid = shmget(key,msize ,0666); if(shmid < 0) { perror("shmwrite error1"); return 1; } shm = (char *)shmat(shmid, NULL, 0); if(shm == NULL) { perror("shmwrite error2"); return 1; } shm[0]=0; printf("Trying to send data\n"); // Display the contents of common RAM as written by perl for(count=0;count