0

I am making a beginner project in C++ "Login and Registration System", now when I was writing the Login(); function I got stuck as I was not able to read the data I stored in the data.txt file in the registration(); function.

void login() {
string username, password, info;
cout << "\t\t\t\t\t\t\Login System" << endl << "\t\t\t\t\tEnter Username:";
cin >> username;
cout << "\t\t\t\t\tEnter Password:";
cin >> password;
ifstream data;
data.open("data.txt");
while (data) {
    getline(data, info);
}
}

Here, this is an error of 'identifier "getline" is unidentified'. I'm using Visual Studio, how can I fix this?

  • 3
    1. Check in what header file [`std::getline()`](https://en.cppreference.com/w/cpp/string/basic_string/getline) is defined. 2. `#include` that header. – Yksisarvinen Mar 23 '23 at 09:35

0 Answers0