开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜