|
Byte buf[] 를 hex 비트체크 연산을 하려고 하는데.... 예로 buf[5]에는 "0x81", buf[6]에는 "0x23" 이
있는데... 이걸 "0x8123"으로 해서 "0x12"와 "0x03"으로 해서 화일에 12와 3으로 저장 하려고 하는데...
어떻게 해야 하나여?? 답변 부탁드립니다.
p.s 손수토님 답변 주셔서 감사합니다.
char *Str = "";
char *sHex,*temp;
Byte szHex[64];
String str1,str2[14];
int i,step=0,check=0,sa=0;
Byte buf[10];
FILE *fdata;
ComLedRx->State = True;
ComPort->ReadStr(str1,Count);
for(i=5; i<7; i++){
buf[i] = szHex[i-5];//temp[i];
Memo->Lines->Add("buf end");
Memo->Lines->Add(buf[i]);
}
buf[7] = (buf[5] * 0x100) + buf[6];
if(buf[7] & 0x8000)
sign = '+';
else
sign = '-';
buf[8] = buf[7] & 0x0FF0;
buf[9] = buf[7] & 0x000F;
fdata = fopen("c:\\jinso0.txt","wt");
fprintf(fdata," %02x . %01x \n", buf[8],buf[9]);
fclose(fdata);
|