title: Cannot convert char* to WCHAR* [qt/c++]
body: <p>im developin QT application, and i need to include pure C code. When i compile this code in code::blocks it was successful, maybe one warning, but when i try to compile it in QT creator, i get these 4 errors.</p>
  
  <pre><code>cannot convert 'char*' to 'WCHAR*' for argument '1' to 'UINT GetSystemDirectoryW(WCHAR*, UINT)'
  cannot convert 'char*' to 'const WCHAR*' for argument '1' to 'HINSTANCE__* LoadLibraryW(const WCHAR*)'
   cannot convert 'char*' to 'WCHAR*' for argument '1' to 'BOOL 
   cannot convert 'const char*' to 'const WCHAR*' for argument '2' to 'LONG RegQueryValueExW(HKEY__*, const WCHAR*, DWORD*, DWORD*, BYTE*, DWORD*)'
  </code></pre>
  
  <p>and the code is here></p>
  
  <pre><code>char systemDirectory[MAX_PATH]; 
  GetSystemDirectory(systemDirectory, MAX_PATH); //first error
  char kbdLayoutFilePath[MAX_PATH];
  kbdLibrary = LoadLibrary(kbdLayoutFilePath); //second error
  char kbdName[KL_NAMELENGTH];
  GetKeyboardLayoutName(kbdName); //third error
  if(RegQueryValueEx(hKey, "Layout File", NULL, &amp;varType, layoutFile, &amp;bufferSize) != ERROR_SUCCESS) //fourth error
  </code></pre>
  
  <p>i also use snprintf function, so i cant just change the type from char to WCHAR, because then it wont compile the snprintf</p>
  
  <pre><code>snprintf(kbdKeyPath, 51 + KL_NAMELENGTH,
  "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\%s", kbdName);
  </code></pre>
  
  <p>So do you have any ideas how to fix it ? first i tried change type from char to WCHAR, but then the snprintf didnt work, so i tried to use swprinf, but with no success, since strangely it didnt find this function</p>
  
  <pre><code>int swprintf(wchar_t *wcs, size_t maxlen,
               const wchar_t *format, ...);
  </code></pre>
  
  <p>but just this</p>
  
  <pre><code>int swprintf(wchar_t *wcs,
                   const wchar_t *format, ...);
  </code></pre>
  
  <p>so what are my option ? How to compile pure C code in c++ environment without any errors... or how to make the right type conversion. </p>