If this a trick question? You're mixing chars and wide chars. On one hand you use _ttoi and _T() and then char and itoa. And you probably build with UNICODE char set.
Make it like this and it will work.
_itot(i, buffer, 10);
str.AppendFormat(_T("Value is : %s\n"), buffer);
But why do you use itoa at all? Simply use CString::AppendFormat() or CString::Format() as already pointed out.