im getting an error with this piece of code, im sure theres a better way to do it but hey its my first shot at it;
thanks for help in advance,Code:string Login() {//function int x,i,y; char Buffer[50], Buffer2[50], Username[50], Password[50]; char ch = getch(); do { system("cls"); cout << "Login" << endl << endl; cout << "Username : "; cin.getline(Username, 50, '\n'); cout << endl; cout << "Password : "; while (ch != '\r') {//while i=0; ch = getch(); Password[i] = ch; //small loop so only * are displayed instead of actual password cout << '*'; i++; }//while ifstream SAM_File("C:\\Documents and Settings\\Dean.Downstairs\\My Documents\\OperationalFiles\\SAMFile.dat"); SAM_File.getline(Buffer, 50); for(x=0; x<50; x++) { SAM_File.getline(Buffer[x],x); //gets set username from .dat file } for(y=0; y<50; y++) { SAM_File.getline(Buffer[y],y); //gets set password from .dat file } SAM_File.close(); ch = ' '; //sets to 0 so its not full } while(Buffer != Username || Buffer2 != Password); };//function



LinkBack URL
About LinkBacks



strings. It makes comparison much easier! You can use the == operator. #include <string>.