| | |
Why is VC++ 2005 beta2 telling me this
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2004
Posts: 140
Reputation:
Solved Threads: 2
Why is VC++ 2005 beta2 telling me this and how do I solve it.
.\Test2.cpp(42) : error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'char *' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Please note that this problem does not exist in VC++ 6.0
.\Test2.cpp(42) : error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'char *' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Please note that this problem does not exist in VC++ 6.0
Want a new website for free:
http://indigo.kjots.com/
http://indigo.kjots.com/
•
•
Join Date: Jul 2005
Posts: 164
Reputation:
Solved Threads: 5
lpcWstr erm wide char type.
char* narrow char type.
There is no relationship between the two types whatsoever therefore static_cast<> cant do it. You must use reinterpret_cast<>. It is only portable and safe if you then use reinterpret_cast<> back to LPCWSTR before using it.
char* narrow char type.
There is no relationship between the two types whatsoever therefore static_cast<> cant do it. You must use reinterpret_cast<>. It is only portable and safe if you then use reinterpret_cast<> back to LPCWSTR before using it.
•
•
Join Date: Aug 2004
Posts: 140
Reputation:
Solved Threads: 2
•
•
•
•
Originally Posted by Stoned_coder
lpcWstr erm wide char type.
char* narrow char type.
There is no relationship between the two types whatsoever therefore static_cast<> cant do it. You must use reinterpret_cast<>. It is only portable and safe if you then use reinterpret_cast<> back to LPCWSTR before using it.
AM sorry but i cannot understand it, can u be more clear
Want a new website for free:
http://indigo.kjots.com/
http://indigo.kjots.com/
•
•
Join Date: Aug 2004
Posts: 140
Reputation:
Solved Threads: 2
•
•
•
•
Originally Posted by winbatch
Post the code. It's likely the function expects 'CString' and you are passing it a char *.
i use it lik that:
FindFirstFile("where.exe", blah blah);
Want a new website for free:
http://indigo.kjots.com/
http://indigo.kjots.com/
•
•
Join Date: Jul 2005
Posts: 164
Reputation:
Solved Threads: 5
look the problem is this simple. You are calling a function that expects a LPCWSTR but you are passing char*. So to fix either pass a LPCWSTR (long pointer to a constant WIDE string) i.e. a unicode string or use the correct function for char*.
![]() |
Similar Threads
- I've found a way to install VS 2005 Beta2 without SP2 (Windows Software)
Other Threads in the C++ Forum
- Previous Thread: How do you build the dot in calculator.
- Next Thread: Difficult
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count database delete desktop developer directshow dll dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline google graph homeworkhelp homeworkhelper iamthwee ifstream input int integer lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






