|
ComPort1->Read(ch, 1);
if(ch[0] == 0x0e)
{
if(SaveDialog1->Execute())
{
RcvDgnPath = SaveDialog1->FileName;
PostMessage(frmMain->Handle, UM_FILERECEIVE, 0, 0);
}
}
이렇게 사용자 저의 메시지로 넘겨주고 메시지에서
while(1)
{
if(m_first != m_last)
{
ComPort1->Read(ch, 1);
data = ch[0];
if(data == 0x04 && size <= 0)
{
fwrite(&data, 1, 1, in);
break;
}
fwrite(&data, 1, 1, in);
size--;
}
else
continue;
}
이렇게 자료를 받습니다. 디버깅을 해도 잘 모르겠습니다.
ch는 unsigned char 이구요
data 는 unsigned int 입니다.
고수님들의 답변 부탁드립니다.
|