Any ideas how this could be converted to a std::string().

So files8 will be converted to a std::string()

System::String ^ files8 = folderBrowserDialog1->SelectedPath->ToString();

This is my problem how to convert in this case: files8 into a LPCSTR.
As I understand from googling around LPCSTR is a const *char but I really cant figure it out where to start.
I would really appreciate codestart help to get on the right track.

System::String ^ files8 = folderBrowserDialog1->SelectedPath->ToString();

// .NET Framework 2.0 or higher

LPSTR to_LPSTR( System::String^ s, char buffer[], std::size_t sz  )
   using namespace Runtime::InteropServices ;
   void* temp = Marshal::StringToHGlobalAnsi(s).ToPointer() ;
   errno_t result = strcpy_s( buffer, sz, (const char*)temp ) ;
   Marshal::FreeHGlobal( IntPtr( temp ) );
   return result==0 ? buffer : 0 ;

System:String^ files8 = folderBrowserDialog1->SelectedPath->ToString();
char buffer[ MAX_PATH ] ;
LPCSTR pcstr = to_LPSTR( files8, buffer, sizeof(buffer) ) ;