c++读取文件内容

//加载文件内容
constchar* filename =”./script/setting.lua”;
std::ifstream in(filename, std::ios::in |std::ios::binary);
if (in)
{
     std::string contents;
     in.seekg(0, std::ios::end);
     contents.resize(in.tellg());
     in.seekg(0, std::ios::beg);
     in.read(&contents[0], contents.size());
     in.close();
     printf(contents.c_str() );
}