//convert from CString to char *, first from CString to wchar_t* then to char *
wchar_t* wCharString = sFile.GetBuffer(sFile.GetLength()+1); //CString to wchar_t*
size_t origsize = wcslen(wCharString) + 1;
size_t convertedChars = 0;

char gszFile[100] = {0};

wcstombs_s(&convertedChars, gszFile, origsize, wCharString , _TRUNCATE); //from wchar_t* to char*


from Hex String to decimal

wchar_t *end = NULL;
long value = wcstol(resp, &end, 16);


sw.Format(_T("%d"),value);