📄 test_tty.c
字号:
/*********************************************************************
* File: test_tty.c
* Author: Embest J.Zhao 2004.3.20
* Desc:
* History:
*********************************************************************/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
int main()
{
int fd;
int n;
char buf[10] = "1234567890";
/* open ttyS0 device file --- S3CEV40 UART0 */
fd = open("/dev/ttyS0", O_RDWR|O_NOCTTY|O_NDELAY);
if(fd == -1)
{
printf("Fail to open /dev/ttyS0\n");
return -1;
}
else
fcntl(fd, F_SETFL, 0);
/* write data to UART0 */
if(write(fd, buf, 10) != 10)
{
printf("Fail to open /dev/ttyS0\n");
return -1;
}
/* close ttyS0 */
close(fd);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -