PDA

View Full Version : Send data to parent process in Qt



PstdEr
20th April 2013, 16:39
I have an application where i launched a process (using QProcess) , from this process i need to send a message to parent process.

from parent


int msgid = msgget(0x1234,IPC_CREAT|0666);
char str[50];
qDebug() << "waiting for msg ";
msgrcv(msgid,str,sizeof str,0,0);

if (!strcmp(str,"sender")){
/*do some processing */
}

from the child


int msgid = msgget(0x1234,IPC_CREAT|0666);
char str[]="sender";
qDebug() << "sending for msg ";
msgsnd(msgid,str,strlen(str)+1,0);



i am getting a msg "waiting for msg" and system is going to hang. what is the problem?

how else will pass msg from one process to other.

Thanks.

amleto
20th April 2013, 17:12
what does your code have to do with Qt?

Look at QProcess for reading standard / error output