バイナリ列をテキストに変換するプログラム


if(theApp.m_IsHex){
// 既存バイナリ列をテキストに変換する
theApp.m_editCtrl->GetWindowText(inputBuffer);
CString transformedBuffer;
for(i=0;i transformedBuffer+=
CString(((inputBuffer.GetAt(i)>'9' ? inputBuffer.GetAt(i)-7-'0' : inputBuffer.GetAt(i)-'0') << 4) & 0xf0
| (inputBuffer.GetAt(i+1)>'9' ? inputBuffer.GetAt(i+1)-7-'0' : inputBuffer.GetAt(i+1)-'0') & 0x0f );
}
theApp.m_editCtrl->SetWindowText(transformedBuffer);
}

 
 もっとシンプルにかけないものか……。