title: Compare WCHAR String with Const Char in C?
body: <p>I have written a code in C which will use the Process32First() API to get information about the process. All the information is stored in the PROCESSENTRY32 structure defined here:</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms684839%28v=vs.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/ms684839%28v=vs.85%29.aspx</a></p>
  
  <p>pe32 is the name of the PROCESSENTRY32 structure.
  process name will be: pe32.szExeFile</p>
  
  <p>I can print it this way:</p>
  
  <pre><code>_tprintf(TEXT("Process name: %s\n"),pe32.szExeFile);
  </code></pre>
  
  <p>now, I want to compare the process name with a specific process like explorer.exe</p>
  
  <p>this is what I am doing:</p>
  
  <pre><code>if(!wcscmp(pe32.szExeFile, _T("explorer.exe"))
  {
   perform some action here;
  }
  </code></pre>
  
  <p>It does not work.</p>
  
  <p>In MS Visual Studio 2008, the data type for szExeFile member of the PROCESSENTRY32 structure is: WCHAR tagPROCESSENTRY32::szExeFile[260]</p>
  
  <p>So, I think it is a Wide Character String?</p>
  
  <p>and explorer.exe is a normal character string (const char *), pointer to an array of characters.</p>
  
  <p>how can I compare szExeFile with a normal string?</p>
  
  <p>I find these data types quite confusing and I hope to understand them better with this example.</p>
  
  <p>Thanks.</p>