Thread: Login Function??

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2006
    Location
    North Yorkshire, England
    Posts
    147

    Login Function??

    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;

    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
    thanks for help in advance,
    Last edited by dac; 12-31-2006 at 03:06 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM