Article ID: 111923
Article Last Modified on 11/21/2006
CString x = "This is a sample CString";
if (x.IsEmpty())
AfxMessageBox("The CString is EMPTY");
else
AfxMessageBox("The CString is not EMPTY");
CString x = "This is a sample CString";
if (x != NULL) // GP Fault for (x == NULL) condition, as well
AfxMessageBox("The CString is not EMPTY");
else
AfxMessageBox("The CString is EMPTY");
Because x is a CString object, not a pointer, it is inappropriate to
compare x to a null pointer.
CString x = "This is a sample CString";
if (x != "")
AfxMessageBox("The CString is not EMPTY");
else
AfxMessageBox("The CString is EMPTY");
Additional query words: CString inequality 2.50 2.51 2.52 3.00 3.10 gpf NULL gp-fault
Keywords: kbhowto kbstring KB111923