$24
Exercise:
Send data from one program to another one!
For that, write two programs, which share the same Named Shared Memory.
Program 1 initializes the shared memory and then waits for a user input at read line (or cin, however you like as long as you can read whole sentences).
Now start program two, which links itself to the shared mem. Print is that was successful (mem is not NULL).
Now write a sentence into program 1.
Program two should regularly check the shared mem. Once its not empty, read and print the sentence and end prog 2.
End program 1 now by typing quit.
Important:
• Sending one sentence is fine. Having a chat program requires much more synchronisation. So stay simple.
• You gonna need to run this exercise in two different command line windows, one for each program.
• Don’t forget to unlink and free the memory correctly!
How we test
Show your two programs and we check if its working.
Submission:
Online or Canvas. Just upload the two c or cpp files, no zipping. Thanks.
YOURNAME_prog1.cpp and YOURNAME_prog2.cpp please.