I want to do the following:
Parent process creates a child process. Then the child process reads n int\'s from the user and store them in a shared memory. The parent
One problem is that the child process is attempting to use get the shared memory before it has been created by the parent. The parent has a wait()
call before creating the shared memory, so it won't exist when the client tries to retrieve the id. Even if the wait() call is moved, it may not work because there is a race condition. The call to shmget
may need to precede the fork
call (or use some synchronization to make sure it actually exists before retrieving it in the child process).
And (as others have already pointed out), the child is attempting to write integers to the memory while the reading (printing of it) tries to treat it as a character string.