C++ - ExpandEnvironmentStrings Giving Conversion Error -


i have been using this:

char appdata[250];     expandenvironmentstrings("%appdata%\\\mcpcmodlocator\\", appdata, 250); 

in c++ win32 appdata folder on 1 of projects. worked fine, no issues. on newest project (same pc, still in visual studio 2013) when try that, error on first string saying "const char* incompatible type lpcwstr" , on second parameter says "char * incompatible type lpwstr". have no idea why work on first project, not second. assume setting change, looking through each projects settings, see nothing. appreciated! thanks!

by default, newly created project in vs2013 has been set use unicode apis, use lpwstr (or, wchar_t*) instead of lpstr(or, char*).

you can call old ansi version apis add "a" @ end of function name explicitly e.g. expandenvironmentstringsa or change project configuration use multibyte character set(project property pages -> configuration properties -> general -> character set)


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -