unix/linux
int len = 0;//缓冲区数据长度
if( -1 != ioctl(fd,FIONREAD,&len ) )
{
}
Windows
DWORD dwErrorFlags = 0L;
COMSTAT ComStat;
if( ClearCommError(hCom,&dwErrorFlags,&ComStat) )
{
ComStat.cbInQue;//缓冲区数据长度
}
unix/linux
int len = 0;//缓冲区数据长度
if( -1 != ioctl(fd,FIONREAD,&len ) )
{
}
Windows
DWORD dwErrorFlags = 0L;
COMSTAT ComStat;
if( ClearCommError(hCom,&dwErrorFlags,&ComStat) )
{
ComStat.cbInQue;//缓冲区数据长度
}
转载于:https://my.oschina.net/mlgb/blog/390966