title: how to convert wchar[260] and wchar_t to const char *
body: <p>This code should check if specified process is running, but it fails on call of stricmp, where both parameters require const char *. How to convert variable processName and member of structure entry.szExeFile (which is wchar[260]) to const char * ?</p>
  
  <pre><code> bool IsProcessRunning(wchar_t processName)
  
  { bool exists = false;
  
  
      PROCESSENTRY32 entry;
      entry.dwSize = sizeof(PROCESSENTRY32);
  
      HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
  
      if (Process32First(snapshot, &amp;entry))
          while (Process32Next(snapshot, &amp;entry)){
              if (stricmp(entry.szExeFile, processName) == 0){
                  exists = true;
  
                  CloseHandle(snapshot);
                  return exists;
              }
          }
  int _tmain(int argc, _TCHAR* argv[])
  {
  
      if (IsProcessRunning(argv[0])) { cout &lt;&lt; "Process " &lt;&lt; argv[0] &lt;&lt; "is running"; }
      return 0;
  }
  </code></pre>