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

关键词:

加入微信
获取电子行业最新资讯
搜索微信公众号:EEPW

或用微信扫描左侧二维码

相关文章

查看电脑版