C++ 为什么visual studio无法识别is_open()函数 #包括 #包括 使用名称空间std; void Readfile(字符串fname) { ifstream infle(fname); 如果(是否打开(填充)) { 而(!infle.eof()) { 字符串sline=“”; getline(填充、sline); } infle.close(); } 其他的 stderr

C++ 为什么visual studio无法识别is_open()函数 #包括 #包括 使用名称空间std; void Readfile(字符串fname) { ifstream infle(fname); 如果(是否打开(填充)) { 而(!infle.eof()) { 字符串sline=“”; getline(填充、sline); } infle.close(); } 其他的 stderr,c++,C++,是std::ifstream的一种方法。使用infle对象调用它: #include <fstream> #include <string> using namespace std; void Readfile(string fname) { ifstream infile(fname); if (is_open(infile)) { while (!infile.eof()) { stri

std::ifstream
的一种方法。使用
infle
对象调用它:

#include <fstream>
#include <string>

using namespace std;
void Readfile(string fname)
{
    ifstream infile(fname);
    if (is_open(infile))
    {
        while (!infile.eof())
        {
            string sline = "";
            getline(infile, sline);
        }
        infile.close();

    }
    else
        stderr << "unable to open file" << fname << endl;

}
std::ifstream
的方法。使用
infle
对象调用它:

#include <fstream>
#include <string>

using namespace std;
void Readfile(string fname)
{
    ifstream infile(fname);
    if (is_open(infile))
    {
        while (!infile.eof())
        {
            string sline = "";
            getline(infile, sline);
        }
        infile.close();

    }
    else
        stderr << "unable to open file" << fname << endl;

}

这是一个成员函数。关于你未来的一个问题,read它是一个成员函数。关于你未来的一个问题,read打败我几秒钟!打败我几秒钟!