how to print data inside a char pointer (c++)?
I have a
function(const char * data)
{
//how to print the data which is inside the data
}
when I debug I see only the address. If I pri开发者_运维百科nt (*data) nothing is printed.
Any idea?
#include <iostream>
void function(const char * data)
{
std::cout << data;
}
printf("%s\n", data)
works for me.
std::cout << std::string(data);
精彩评论