-1
Good afternoon everyone, here’s the problem. I have data inside the txt file and when in the program the user is asked to enter login and password for comparison, it simply stays in a loop. Can someone give me a light please? I’ve researched enough and still can’t solve my problem! Below I’ll leave the code.
void entrar(void) {
usu.open("usu_admin.txt", ios::in);
if(!usu) {
cout << "Sistema de cadastro | Infra.V.1.0 - Entrar"
<< endl << endl << "Usuario admin nao cadastrado!"
<< endl << endl << "Aguarde um momento...";
this_thread::sleep_for(chrono::seconds(3));
system("cls");
cad_admin();
}
else {
while(getline(usu, linha)) {
cout << "Sistema de cadastro | Infra.V.1.0 - Entrar"
<< endl << "Login admin: ";
cin >> l;
cin.clear();
cout << "Senha admin: ";
for(i=0;i<6;i++) {
cin.clear();
s[i]=getch ();
putchar ('*');
}
cout << endl << endl << "Aguarde um momento...";
this_thread::sleep_for(chrono::seconds(3));
char* linTemp;
linTemp=&linha[0];
if((strcmp(l, linTemp)==0) && (strcmp(s, linTemp)==0)) {
system ("cls");
menu ();
}
}
}
usu.close();
}
post an entire, compileable program. Help others help you
– arfneto
Hello, follow the code. Thanks for the answer. I could not post it in the correct way of code. But all the lines of it are present...
– Bruno Bernardes
:) it was funny. It should be able to join. To make it easier for you can use ``` before and after the code. The crack sign, not the apostrophe, 3 times at the beginning of the line, before and after and the editor Mark-Down understands as code what is in the middle. You can also copy the whole code to the post, select the first letter and go down with the keyboard, keeping shift tight so as to select the whole program, and then fix control-k. More boring but works too.
– arfneto