CString strhex = _T("8CEF");
_tprintf(_T("hex: %s \n"), (LPCTSTR)strhex);
unsigned long dec = _tcstoul(strhex, NULL, 16);
_tprintf(_T("dec: %d \n"), dec);
CString bin;
CString buf;
TCHAR mod[2];
do
{
_ultot(dec % 2, mod, 2);
buf = mod;
buf += bin;
bin = buf;
} while (dec = dec / 2);
_tprintf(_T("bin: %s \n"), (LPCTSTR)bin);
_tprintf(_T("hex: %s \n"), (LPCTSTR)strhex);
unsigned long dec = _tcstoul(strhex, NULL, 16);
_tprintf(_T("dec: %d \n"), dec);
CString bin;
CString buf;
TCHAR mod[2];
do
{
_ultot(dec % 2, mod, 2);
buf = mod;
buf += bin;
bin = buf;
} while (dec = dec / 2);
_tprintf(_T("bin: %s \n"), (LPCTSTR)bin);
CString strhex = _T("8CEF");
_tprintf(_T("hex: %s \n"), (LPCTSTR)strhex);
unsigned long dec = _tcstoul(strhex, NULL, 16);
_tprintf(_T("dec: %d \n"), dec);
TCHAR bin[1024];
_ultot(dec, bin, 2);
_tprintf(_T("bin: %s \n"), bin);
_tprintf(_T("hex: %s \n"), (LPCTSTR)strhex);
unsigned long dec = _tcstoul(strhex, NULL, 16);
_tprintf(_T("dec: %d \n"), dec);
TCHAR bin[1024];
_ultot(dec, bin, 2);
_tprintf(_T("bin: %s \n"), bin);
'Code > C C++' 카테고리의 다른 글
| [C++/CLI] #pragma managed, #pragma unmanaged (0) | 2009.05.09 |
|---|---|
| [C++/CLI] #pragma managed, #pragma unmanaged, Windows API (0) | 2009.05.09 |
| [MFC] CString Sample (0) | 2009.03.17 |
| [C/C++] Dialog Test Sample Project (0) | 2008.11.11 |
| [C/C++] Dely (0) | 2008.11.09 |