user space串口编程

xiaoxiao2021-02-27  594

源码:

#include     <stdio.h>

#include     <stdlib.h> #include     <unistd.h> #include     <sys/types.h> #include     <sys/stat.h> #include     <fcntl.h> #include     <termios.h> #include     <errno.h> int main(int argc, char **argv){         int fd = open("/dev/tty0" , O_RDWR );       while (1) {         write(fd, "hello" ,6); } }

编译和运行

结果:

转载请注明原文地址: https://www.6miu.com/read-1196.html

最新回复(0)