2
votes

I have added a simple Cedit control to my dialog and have an OnEnChangeEdit callback. I am trying to retrieve the text that is typed in the box, but can only get the first character of what is typed in that call to printf below:

void MFCDlg::OnEnChangeEdit() { 
  CString s; 
  m_platformSliceOverrideEditBox.GetWindowText(s); 
  _cprintf("%s", s.GetString());
}

If it helps I am using the Unicode character set for compilation.

1

1 Answers

2
votes

_cprintf expects ansi strings. If you are using unicode then it will stop at the first character because the second byte will be a null.

use _tcprintf instead which will expect wide strings when you build as unicode.