curses (ncurses) library question

Hi again. I'm using the curses functions simply to output data to
the screen in certain areas. Very simple, just using the full
screen, no windows.

The problem is that I'm calling mvprintw from within several child
processes in the same session, and the output is going
bananas. ie, no matter what x and y values I put in the
mvprintw, the output appears at the last cursor position of
another child process.

I found some info about a buffering problem, but I followed all
their suggestions and came up with the same result.

The code should output this:
0 2 4 6 8
1 3 5 7 9

but instead outputs this:
0 3 2 5 4 7 6 9 8
1

Here's the code: OH, and thanks to the kind person who replied
to my post about IPC...that helped me immensely. The ipc_
functions below are wrappers for the mutexes and shared
memory functions:

<pre>
int Print(int, int, char *);

struct shared_memory
{
int sem;
// void *pPrint;
WINDOW *win;
// SCREEN *scr;
};

struct shared_memory *sm = NULL;

int main(int argc, char** argv)
{
pid_t p;
int ch;
char temp[5];

sm = ipc\_sram_alloc\(1, sizeof\(struct shared_memory\)\);
if \(sm == \(void *\)NULL\)
	exit\(0\);

// sm->pPrint = (void *)Print;

ipc\_mutex_alloc\(&sm-&gt;sem, 0\);

if \(sm-&gt;sem &lt; 0\)
	printf\("BAD mutex\\r\\n"\);

sm-&gt;win = initscr\(\);
wclear\(sm-&gt;win\);
wrefresh\(sm-&gt;win\);

p = fork\(\);
if \(p == 0\) // If we are a child process
\{
	for \(ch = 0; ch &lt; 10; ch \+= 2\)
	\{
		usleep\(500000\);
		sprintf\(temp, "%d", ch\);
		Print\(9, ch \+ 1, temp\);
		usleep\(500000\);
	\}
	exit\(0\);
\}
else // otherwise we're in the parent
\{
	for \(ch = 1; ch &lt; 10; ch \+= 2\)
	\{
		usleep\(500000\);
		sprintf\(temp, "%d", ch\);
		Print\(10, ch \+ 1, temp\);
		usleep\(500000\);
	\}		
\}

wait\(NULL\); // wait for child to die
endwin\(\);
ipc\_mutex_free\(sm-&gt;sem\);
ipc\_sram_free\(sm\);

}

int Print(int row, int col, char *psz)
{
ipc_mutex_acquire(sm->sem);
mvwprintw(sm->win, row, col, psz);
wrefresh(sm->win);
// mvprintw(row, col, psz);
// refresh();
ipc_mutex_release(sm->sem);
return 0;
}
</pre>

Forgot to tell you, I'm using LINUX 6.2, and the curses rpm's installed are:

ncurses-5.0-11
ncurses-devel-5.0-11