I want to convert System::String ^ to LPCWSTR.
for
FindFirstFile(LPCWSTR,WIN32_FIND_DATA);
Please help.
To convert a System::String ot LPCWSTR in C++/CLI you can you use the Marshal::StringToHGlobalAnsi function to convert managed strings to unmanaged strings.
System::String ^str = "Hello World";
IntPtr ptr = System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(str);
HANDLE hFind = FindFirstFile((LPCSTR)ptr.ToPointer(), data);
System::Runtime::InteropServices::Marshal::FreeHGlobal(ptr);