首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

援助:VC mfc,使用ReadFile读串口,读不到16进制00

2013-04-21 
救助:VC mfc,使用ReadFile读串口,读不到16进制00救助:VC mfc,使用ReadFile读串口,读不到16进制00char r_bu

救助:VC mfc,使用ReadFile读串口,读不到16进制00
救助:VC mfc,使用ReadFile读串口,读不到16进制00
char r_buf[1024];

bResult=ReadFile(h_comm[num],r_buf,10,&len,0);

假设我发送:01 00 02
但是提示收到的长度只有2,中间的0x00丢掉了。。
[解决办法]
typedef struct _DCB { // dcb 
    DWORD DCBlength;           // sizeof(DCB) 
    DWORD BaudRate;            // current baud rate 
    DWORD fBinary: 1;          // binary mode, no EOF check 
    DWORD fParity: 1;          // enable parity checking 
    DWORD fOutxCtsFlow:1;      // CTS output flow control 
    DWORD fOutxDsrFlow:1;      // DSR output flow control 
    DWORD fDtrControl:2;       // DTR flow control type 
    DWORD fDsrSensitivity:1;   // DSR sensitivity 
    DWORD fTXContinueOnXoff:1; // XOFF continues Tx 
    DWORD fOutX: 1;            // XON/XOFF out flow control 
    DWORD fInX: 1;             // XON/XOFF in flow control 
    DWORD fErrorChar: 1;       // enable error replacement 
    DWORD fNull: 1;            // enable null stripping 

热点排行