怎么没人回啊;  贴代码如下:
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/signal.h>
#include <fcntl.h>
#include <termios.h>
#include <stdio.h>  
#include <string.h>
#include <unistd.h>
#include <errno.h>    
#include <stdlib.h>
#define   MODEMDEVICE    "/dev/ttyS0"
void getErrno()
{
    switch(errno)
    {
    case EINTR:printf(" EINTR!!");break;
    case EAGAIN:printf(" EAGAIN!!");break;
    case EBADF:printf(" EADF!!");break;
    default:printf(" No errno!");
    }
}
int main()
{
    int     fd,readnum=0,writenum=0,n = 0;
    struct termios oldtio,newtio;
    char buf[15],readbuf[20]={'a'};
    strcpy(buf,"ATD13631562519;");
    printf("start ...\n");
 
    fd = open(MODEMDEVICE,O_RDWR | O_NOCTTY); //| O_NONBLOCK ); 
    if (fd < 0 )
    {
       perror(MODEMDEVICE);
       exit(1);
    }
    printf("open...fd=%d\n",fd);
    tcgetattr(fd,&oldtio);
    tcgetattr(fd,&newtio);
    tcflush(fd,TCIOFLUSH);
    bzero(&newtio,sizeof(newtio));
    
    newtio.c_cflag &= ~PARENB;
    newtio.c_iflag &= ~INPCK;
    newtio.c_cflag &= ~CSTOPB;
    newtio.c_cflag &= ~CSIZE;
    newtio.c_cflag |= CS8;
    
    cfsetispeed(&newtio,B115200);
    cfsetospeed(&newtio,B115200);
    //newtio.c_cc[VTIME] = 0;    
    //newtio.c_cc[VMIN]  = 1;
    
    newtio.c_iflag &= ~(ICANON | ECHO |ECHOE |ISIG);
    newtio.c_oflag &= ~OPOST;
    if(tcsetattr(fd,TCSANOW,&newtio) != 0)
    printf("Set Failed");
    printf("writing data...\n");
    tcflush(fd,TCIOFLUSH);
   
    //while(n<5)
    {
    writenum = write(fd,buf,sizeof(buf));
    printf("\n WriteNumber=%d ",writenum);
    getErrno();
    
    n++;
    }
        tcflush(fd,TCOFLUSH);
    printf("\nreading data...\n");
    while(readbuf[0] != 'q')
    {    
        readnum = read(fd,readbuf,25);
        printf("ReadNum=%d,%s",readnum,readbuf);
        getErrno();
    }
    tcsetattr(fd,TCSANOW,&oldtio);
    printf("\n close...\n");
    close(fd);
    return 0;
}