controlling a modem through GTK+ program



I have developed a small routine in gtk, that dials a number through a modem on click of GtkButton. The modem dials the number but the parent GtkWindow becomes unresponsive because the program control is on the modem. How do I get the control back on GtkWindow. Attached is the code.

void dialcon (char phnumber[20])
{
   char callroute[20];
   strcpy(callroute,"ATDT0,");
   strcat(callroute, phnumber);
   strcat(callroute,"\n\r");
   n = write(fd, callroute, 19);
   if (n < 0)
      puts("write() of 19 bytes failed!");
   fcntl(fd, F_SETFL, FNDELAY);
   while(str[0] != 'Q')
   {
    sleep(5);
    if(read(fd, str, 1) != -1)
    {
      printf("%s\n", str);
    }
} }

Please advise where am I going wrong.

Regards
Rajesh Jha




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]