Dear All,

with the following code i am expecting modem out put to buffer.
here its not responding.
Is it delay problem ??

kindly suggest the same.

char buffer[255]; /* Input buffer */

/* send an AT command followed by a CR */
write(fd, "AT\r", 3);
sleep(2);
printf("res1= %d\n",res);

/* read characters into our string buffer until we get a CR or NL */
bufptr = buffer;
while ((nbytes = read(fd, bufptr, buffer + sizeof(buffer) - bufptr - 1)) > 0)
{
bufptr += nbytes;
printf("nbytes = %d\n",nbytes);
if (bufptr[-1] == '\n' || bufptr[-1] == '\r')
break;
}
/* nul terminate the string and see if we got an OK response */
*bufptr = '\0';
if (strncmp(buffer, "OK", 2) == 0)
return (0);


Thanks in advance
John