确定!
代码如下
static STATUS RecvDataWithTimeOut(UINT16 datacount,UINT16 timeoutvalue)
{
UINT16 bytesRead;
UINT32 i = 0;
struct timeval timeout;
int selectnum;
struct fd_set readFds; /* 串口bit mask of fds to read from */
int width; /* number of fds on which to pend */
if (selectnum == ERROR)
{
#ifdef DEBUG_PRINT
printErr("ERROR:An select error has occurred in received data from COM2!\n");
#endif
return ERROR;
}
else if(selectnum == 0)
{
#ifdef DEBUG_PRINT
printErr("ERROR:An timeout error has occurred in received data from COM2!\n");
#endif
return ERROR;
}
if (FD_ISSET (comm2Fd, &readFds))
{
bytesRead = fioRead(comm2Fd,szBuf,datacount);
..\temp.c: In function `RecvDataWithTimeOut':
..\temp.c:75: `comm2Fd' undeclared (first use in this function)
..\temp.c:75: (Each undeclared identifier is reported only once
..\temp.c:75: for each function it appears in.)
..\temp.c:85: parse error before `else'
..\temp.c:105: `szBuf' undeclared (first use in this function)
不好意思,昨天着急打错了,但是跟踪加的位置是没错的,请各位大侠原谅,
代码如下
static STATUS RecvDataWithTimeOut(UINT16 datacount,UINT16 timeoutvalue)
{
UINT16 bytesRead;
UINT32 i = 0;
struct timeval timeout;
int selectnum;
struct fd_set readFds; /* 串口bit mask of fds to read from */
int width; /* number of fds on which to pend */
if (selectnum == ERROR)
{
#ifdef DEBUG_PRINT
printErr("ERROR:An select error has occurred in received data from COM2!\n");
#endif
return ERROR;
}
else if(selectnum == 0)
{
#ifdef DEBUG_PRINT
printErr("ERROR:An timeout error has occurred in received data from COM2!\n");
#endif
return ERROR;
}
if (FD_ISSET (comm2Fd, &readFds))
{
bytesRead = fioRead(comm2Fd,szBuf,datacount);