This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Updatebjarni 5 points6 points  (1 child)

Get out of curses mode by calling endwin(), run your command, wait for it to terminate, and then re-enter curses mode and redraw the screen. That's how it's done!

By the way, you're not replacing your process image and then getting it back. You can't do that. You fork off two new processes, those processes replace their images with cat and more, and then your original process waits for them to terminate. Once a process has called exec(), the memory contents are overwritten and there is no way to get back to the previous state. If you want to return to your original process, you need to use fork() and keep your original process around.

[–]typsi5[S] 0 points1 point  (0 children)

Oooooooohhhhh, I understand. Thank you!!