i cannot understand why the printf is not working. the message from the compiler is :
[Warning] cannot pass objects of non-POD type `struct std::basic_string<char, std::char_traits<char>, std::allocator<char> >' through `...'; call will abort at runtime
printf format specifier %s is looking for the plain old char * but string is a standard C++ class. So C++ provide the c_str() method for you to get back the plain old char *