开发者

ifstream arguments - C++

I Declared: std::string input_file="1.txt";开发者_StackOverflow then I tried to do this command:

static ifstream myfile (input_file);

and I get the error: no matching function for call to : std::basic_ifstream<char>::basic_ifstream(std::string&)


Try:

static ifstream myfile(input_file.c_str());

For some reason, the ifstream constructor doesn't accept an std::string.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜