System::String* to char*

  • Thread starter Thread starter Peteroid
  • Start date Start date
P

Peteroid

The application path can be obtained as:
Application::ExecutablePath

But this is a String*. I need to convert this to a char* so it can be used
by PlaySound(). How can I do this? Alternately, is there a way to obtain the
application path directly as a char* ?

Thanks in advance! : )

[==Peter==]
 
Peteroid said:
The application path can be obtained as:
Application::ExecutablePath

But this is a String*. I need to convert this to a char* so it can
be used by PlaySound(). How can I do this? Alternately, is there a
way to obtain the application path directly as a char* ?

Since you're calling Windows API function, why not use a Windows API
function for getting the executable path:
char szPath[MAX_PATH];
GetModuleFileName(NULL, szPath, MAX_PATH);
 
Back
Top