How do Multi-process use the same ncurses screen?
<p>I'm writing a c++ multi-process program with ncurses.</p>

<p>Each process is required to display something on the screen.</p>

<p>My Example code:</p>

<pre><code>int main() {
  initscr();
  noecho();
  curs_set(0);

  int flag = fork();
  if (flag == -1)
    exit(1);
  else if (flag == 0) {
    WINDOW *win = newwin(4, 4, 0, 0);
    int n = 0;
    while (1) {
      mvwprintw(win, 0, 0, "%d", n % 9);
      wrefresh(win);
      n = (n + 1) % 9;
      sleep(1);
    }
  }
  else {
    WINDOW *win = newwin(4, 4, 8, 8);
    int n = 0;
    while (1) {
      mvwprintw(win, 0, 0, "%d", n % 9);
      wrefresh(win);
      n = (n + 1) % 9;
      sleep(1);
    }
  }
  endwin();

  return 0;
}
</code></pre>

<p>But it can only display one process's information on the screen.</p>

<p>How can I solve it?</p>