c - Creating a shared string array which children processes can access -


i declaring array of string using

char users[10][256]; 

then forking , creating 10 child processes. need each child process access , modify string array. how do ?

you'd want use shared memory.

under linux, can check this out. uses shmget, shmat , shmdt create shared memory segments, shared memory segments , detach shared memory segments respectfully.

under windows, can check this out. uses openfilemapping , mapviewoffile create "file mappings" , map them process's virtual memory respectfully.

both, finally, achieve same result.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -