Ok, so I've read up on ASCII and unicode and I'm pretty sure I understand. What I don't understand is how to get from one kind of string to another. For instance, Let's say I'm writing a program with .net so I'm using System::String but I want to use wmp3lib to play an mp3, which takes a char * for the filename, how do I get from one to another? Same problem when using WIN32? I know I can use filename.ToCharArray but that returns a cli::array<char>* and not a standard char*. Some point me in the right direction please?
In C++/CLI you can use all(?) the standard-classes of ISOC++ ( <-- That's the real C++ ). That means:
If you are using a library, that want's a const char*, your code would look like so:
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <string> // for std::string
#include <Mp3Library>
std::string MyLovelySong ("Titanic-Celine Dion.mp3") ;
Mp3Library::PlaySong(MyLovelySong .c_str()) ; // Mp3Library::PlaySong(..) want's a const char* so we call the method of std::string, which is 'c_str()' and he is giving us a const char*.
// and if the function would like have a char*, your code would look like so:
char* MyLovelySong = "House from Ibiza 107-Sebastien.mp3" ;
Mp3Library::PlaySong(MyLovelySong) ;
I have Visual Studio 2008, but I don't have these files. Are they avaliable in a library I can download? I downloaded marshal.h, but I still don't have the files I need to go with that e.g. glib-object.h