```clike=
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <string.h>
#include <termios.h>
#define dev_uart "/dev/ttySAC3"
#define test "test.txt"
int main(int argc , char *argv[])
{
int fh, cnt=0, fd;
char bfr;
struct termios original_t, new_t;
printf("I/O test for UART driver \n");
printf("Press Ctrl C to exit\n");
fh = open(dev_uart, O_RDWR);
fd = fileno(fopen(test, "w+"));
tcgetattr(fh, &original_t);
memcpy(&new_t, &original_t, sizeof(new_t));
new_t.c_cflag &= (B9600 | CS8 | CREAD | CLOCAL);
new_t.c_cflag &= ~(PARENB | CSTOPB);
new_t.c_oflag = 0;
new_t.c_lflag = 0;
tcflush(fh,TCIFLUSH);
tcsetattr(fh, TCSANOW, &new_t);
while(1) {
cnt = read(fh, &bfr, 1);
write(fd, &bfr, 1);
if(cnt > 0) {
printf("read %d characters: %c\n", cnt, bfr);
}
}
/*
while(1) {
cnt = write(fd, &bfr, 1);
if(cnt > 0) {
printf("read %d characters: %c\n", cnt, bfr);
}
}
*/
close(fd);
close(fh);
tcsetattr(fh, TCSANOW, &original_t);
return 0;
}
```