I am making a registration, for my database, but the compiller always says to me:
no matching function for call to 'std::basic_ifstream::getline(std::__cxx11::string&, int&)' getText.getline(pass_password, data_count_password);
I do not understand where is the mistake in my code..Can anyone help me?
Code :
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
bool is_user = false,startDatabase = false;
string file_text;
string username;
string password;
string repeat_password;
bool isCorrect = false;
int main(int argc, char const *argv[])
{
ofstream setText("user_data.txt");
ifstream getText("user_data.txt");
getText.getline(file_text,10);
if(file_text == ""){
while(!isCorrect){
cout << "For using our dataBase, please enter data for
privacy \nUsername : ";
cin >> username;
cout << "Password : ";
cin >> password;
cout << "Repeat password : ";
cin >> repeat_password;
if(password == repeat_password){
isCorrect = true;
}else{
cout << "Please, repeat and enter identistic passwords!";
isCorrect = false;
}
}
setText << username << password;
}else{
int data_count_username = username.length();
int data_count_password = password.length();
string pass_password;
string pass_username;
cout << "Please enter your data " << endl << "Username : ";
cin >> username;
cout << "Password : ";
cin >> password;
getText.getline(pass_username,data_count_username);
getText.getline(pass_password, data_count_password);
if(pass_username == username && pass_password == password){
startDatabase = true;
}
}
setText.close();
getText.close();
return 0;
}
采用:
std::getline(getText,file_text);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.