Note that there are some explanatory texts on larger screens.

plurals
  1. POcpp issue with wide char and windows functions
    primarykey
    data
    text
    <pre><code>static void GetFilesFromDir(std::string dir, std::vector&lt;std::string&gt;&amp; items) { WIN32_FIND_DATA findData; HANDLE hFind=FindFirstFile((dir+"\\*").c_str(), &amp;findData); //1 error do { if(hFind != INVALID_HANDLE_VALUE) { std::string sFileName = findData.cFileName; //2 error LPCSTR lp(sFileName.c_str()); if(sFileName == "." || sFileName == "..") {} //do nothing else if (findData.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY) GetFilesFromDir(dir+"\\"+sFileName, items); else items.push_back(dir+"\\"+sFileName); } } while (FindNextFile(hFind, &amp;findData)); } </code></pre> <p>So here's my simple function that I just coppied from another project to the new one. And it throws errors for no reason I can think of, especially because it works in other projects... </p> <pre><code>1&gt;c:\users\prog\documents\visual studio 2010\projects\vampire stealth\vampire stealth\smallfunctions.h(22): error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR' 1&gt; Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1&gt;c:\users\prog\documents\visual studio 2010\projects\vampire stealth\vampire stealth\smallfunctions.h(27): error C2440: 'initializing' : cannot convert from 'WCHAR [260]' to 'std::basic_string&lt;_Elem,_Traits,_Ax&gt;' 1&gt; with 1&gt; [ 1&gt; _Elem=char, 1&gt; _Traits=std::char_traits&lt;char&gt;, 1&gt; _Ax=std::allocator&lt;char&gt; 1&gt; ] 1&gt; No constructor could take the source type, or constructor overload resolution was ambiguous </code></pre> <p>Anyone has any ideas on what's wrong? I'm totally clueless about it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload