#include#include int main() { BString str("Hello world"); const char* ansistr = str.getAnsi(); printf("%s\n", ansistr); return 0; }
#includeIn this example, we have an external library function called myLibraryFunction that takes a null-terminated C string as input. We create a BString object and pass its underlying C string to the library function using getAnsi. Package/Library: BeOS/Haiku OS SDK (libbe.so)#include #include extern "C" { void myLibraryFunction(const char* str); } int main() { BString str("Hello world"); myLibraryFunction(str.getAnsi()); return 0; }