linux串口传文件程序

2019-07-12 23:27发布

今天下午写了个串口传文件的程序,发现每次接收时读串口得到的大小都是8个字节左右,不知道什么原因?
以下程序演示了怎样通过串口传文件

编译后先执行./receive
在另一个终端./send tt.txt(单机测试连串口23脚,tt.txt是我当前目录下的一个文件)
这样会在当前目录下生成副本serialdata文件
两个程序的源代码如下:
/*------------------------ send.c -----------------------------------*/
/*
dong? possible problems
1: if the sending file is very big, the program will work?
2: if there are some binary files with data '