Quote:
Originally Posted by
dgre0018
do you think it's possible to have a process write the WINDOW to a file which multiple processes read from simultaneously?
curses won't treat a file like a terminal and won't be fooled. Besides, whose to say all your clients will be using the same terminal? You need to let your clients do their own drawing.
Quote:
I had tried to do this using shared memory by having the window kept in shared memory but each time I accessed the window from the child process I kept getting a segmentation fault.
This is because, as stated twice previously, curses does not work that way. A WINDOW structure created in one process won't be valid in another. In fact any pointers and things containing pointers won't be valid when shared. Pointers point to memory
local to its process, if they even point to
any valid memory in a different process it will be a complete coincidence.
I think you're going to have to give up on sharing
terminals with other processes and share
data with them instead. Tell them what to draw but let them do their own drawing. (or just redraw everything every frame, and make it more efficient later.) You could keep an 80x25 character array in shared mem, and communicate to your clients what sections they need to redraw, or perhaps just when. I do think you'll need synchronization to accomplish this well.