Bonjour,

je n'arrive pas � convertir un string^ vers une valeur de type char* :

Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
String^ sPage = gcnew String("bonjour");
IntPtr p=System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(sPage);
char *chaineChar = reinterpret_cast<char*>(static_cast<void *>(p));
System::Runtime::InteropServices::Marshal::FreeHGlobal(p);
le prob dans ce code source c'est que chaineChar ne contient pas "bonjour" mais "true" quand je l'affiche ??

pourtant j'ai suivi la FAQ C++/CLI qui donne la m�thode pour convertir un string^ vers du char*, o� est l'erreur dans mon code source ?

http://dotnet.developpez.com/faq/cpp...n#stringtochar

d�sol� je d�bute aussi dans l'univers du C++/CLI

merci par avance