dimanche 19 septembre 2021

Why does the compiler report an error to getline in this code?

#include <iostream>
#include <fstream>

int main()
{
    using namespace std;
    char name[60] = { };
    cout << "输入:";
    cin.getline(name, 60);
    ifstream In;
    In.open(name);
    char* something = new char[100];
    //char something;
    In.getline(*something, 100);


    return 121;
}

As you can see, this code reports an error for In.getline(*something, 100);. Who knows how to solve this problem?

Aucun commentaire:

Enregistrer un commentaire