当前位置: 技术问答>linux和unix
一个串口通讯程序,可是编译是总是报assert的错误!!!
来源: 互联网 发布时间:2015-10-11
本文导语: #include #include #include #include #include #include #define RCV_LEN 32 #define SND_LEN 16 #define TIMES 3 void receive(int fd) {int file_desc,errorcode; char rec_buf[33]; file_desc=fd; errorcode=read(file_desc,rec_buf,RCV_LEN); assert(errorcode>...
#include
#include
#include
#include
#include
#include
#define RCV_LEN 32
#define SND_LEN 16
#define TIMES 3
void receive(int fd)
{int file_desc,errorcode;
char rec_buf[33];
file_desc=fd;
errorcode=read(file_desc,rec_buf,RCV_LEN);
assert(errorcode>=0);
printf("The received string is %s",rec_buf);
}
void send (int file_d)
{int file_desc,errorcode,fd;
char snd_buf[17];
file_d=fd;
printf("Please enter a string to send(
#include
#include
#include
#include
#include
#define RCV_LEN 32
#define SND_LEN 16
#define TIMES 3
void receive(int fd)
{int file_desc,errorcode;
char rec_buf[33];
file_desc=fd;
errorcode=read(file_desc,rec_buf,RCV_LEN);
assert(errorcode>=0);
printf("The received string is %s",rec_buf);
}
void send (int file_d)
{int file_desc,errorcode,fd;
char snd_buf[17];
file_d=fd;
printf("Please enter a string to send(