views:

60

answers:

0

I have a problem with ReadFile function in a virtual serial port:

char tmp[128];
int multiplo=0;
DWORD err;
COMSTAT stt;

ClearCommError(hcom, &err, &stt);
do{
    if(ReadFile(hcom, tmp, stt.cbInQue, &err, NULL)){
        tmp[err] = '\0';
        memcpy(bfIn+multiplo, tmp, err);
        multiplo = multiplo + err;
    }else
        return 0;
}while(err > 0);

this code works when ReadFile get valid character like 0x01, 0x02, 0x03... but there is a problem with 0x00, the code doesn't read like I expected, I try with hyperterminal and that works perfect.

I've defined in dcb structure:

dcb.fNull = false;

but still I have the same problem, any help?