📜  如何在 C++ 代码示例中输入文件路径

📅  最后修改于: 2022-03-11 14:44:58.745000             🧑  作者: Mango

代码示例1
int main()
{
    std::cout << "Please enter the file name: ";
    std::string name;
    std::getline (std::cin, name);
    ifstream ifs(name.c_str());
    if (!ifs) error("can't open input file ", name);

    vector < Point > points;
    Point p;
    while (ifs >> p) points.push_back(p);
    // ....
}