memset(buf, 0, sizeof(buf)); FD_ZERO(&fds); FD_SET(fd, &fds); select(FD_SETSIZE, &fds, NULL, NULL, &timeout); read(fd,buf,255); //read response "+CMGW: ID" printf("got response <- %s\n",buf);