You may safely compare the two string using the
CString ==
operator (see
MSDN[
^]), e.g.
CString str = _T("FOO");
TCHAR s[] = _T("FOO");
if ( str == s )
{}
Please note, your code
Quote:
TCHAR szFile1 = new TCHAR[100];
szFile1 = "d:\\gh";
features, at least, two mistakes:
- You are trying to assigning an array to a single
TCHAR
variable (compiler error). - If you fix the previous error then, with next statement you are discarding the reference to dynamically allocated memory (runtime bad behavior: memory leak).