0

I migrated the code from C++ to VS C++.Net.
I got following error.

u.ui2_local = (char *) wcsLocal;
u.ui2_remote = (char *) wcsRemote;

error C2440: '=' : cannot convert from 'char *' to 'LPWSTR' for both.


rc = NetUseDel(NULL, (char *) wcsPath, lForce ? USE_LOTS_OF_FORCE : USE_NOFORCE);

error C2664: 'NetUseDel' : cannot convert parameter 2 from 'char *' to 'LPWSTR' 

I tried removing (char *) and it works fine. I am using VS 2010. I am a newbie in Win C++.

I am not sure as removing (char *) will still produce correct output. The project is big and i can't test by removing it and running the app to see the output.

Please Advise.
Thanks

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by thines01
0

Your best bet would be to create a test project with the same types of objects on both sides of the = sign. Fill the right side with values and watch it copy from right to left in the debugger.

Also, when I converted an MFC project to MFC+CLI, I had to change the character set from Unicode to "Use Multi-Byte Character Set"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.