how to input a file path in c 2b 2b

Solutions on MaxInterview for how to input a file path in c 2b 2b by the best coders in the world

showing results for - "how to input a file path in c 2b 2b"
Elin
28 Nov 2019
1int main()
2{
3    std::cout << "Please enter the file name: ";
4    std::string name;
5    std::getline (std::cin, name);
6    ifstream ifs(name.c_str());
7    if (!ifs) error("can't open input file ", name);
8
9    vector < Point > points;
10    Point p;
11    while (ifs >> p) points.push_back(p);
12    // ....
13}