进程控制问题,求达人指教
switch(event-> keyval)
{
case GDK_Return:
if(player==1)
{
child_pid=fork();
if(child_pid==-1)
{
return;
}
if(child_pid==0)
{
memset(buf,0,sizeof(gint)*7);
len=recv(clifd1,buf,sizeof(gint)*7,0);
if(len==sizeof(gint)*7)
{
whiteflag=1;
g_print( "%d\n ",buf[0]);
g_print( "%d\n ",buf[1]);
g_print( "%d\n ",buf[2]);
g_print( "%d\n ",buf[3]);
g_print( "%d\n ",buf[4]);
g_print( "%d\n ",buf[5]);
g_print( "%d\n ",buf[6]);
num=buf[2]*(LINE+1)+buf[1];
g_print( "%d\n ",num);
MyStoreItem[num].type=buf[0];
MyStoreItem[num].x=buf[1];
MyStoreItem[num].y=buf[2];
MyStoreItem[num].dir.udnum=buf[3];