新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > linux基础复习(7)串口应用开发

linux基础复习(7)串口应用开发

作者: 时间:2016-10-08 来源:网络 收藏

printf(fcntl=%dn,fcntl(fd, F_SETFL,0));

if(isatty(STDIN_FILENO)==0)

printf(standard input is not a terminal devicen);

else

printf(isatty success!n);

printf(fd-open=%dn,fd);

return fd;

}

int main(void)

{

int fd;

int nread,i;

char buff[]=Hellon;

if((fd=open_port(fd,1))0){

perror(open_port error);

return;

}

if((i=set_opt(fd,115200,8,'N',1))0){

perror(set_opt error);

return;

}

printf(fd=%dn,fd);

// fd=3;

nread=read(fd,buff,8);

printf(nread=%d,%sn,nread,buff);

close(fd);

return;

}


上一页 1 2 3 下一页

关键词:

评论


相关推荐

技术专区

关闭