DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2007

    Question Help with text file

    I am doing a project and i want to have a text file with usernames and passwords like

    john 12345
    nick 56780
    taki 9087

    and i will put a login form so the user will type the username and password and through the text file, the program will check the information and then login. So i want some help how to write the code to check this information when the user type them.

  2. #2
    Join Date
    Apr 2007
    Sterling Heights, Michigan
    Have a look at this thread.

  3. #3
    Join Date
    Dec 2004
    San Bernardino County, California
    You will be able to hard-code the file name and location. I'd suggest that you load the file only once for each session - the first time someone logs in - and that you read the data into a map/dictionary collection with the key being whatever "public" information you have. I would write file loading method using a Scanner object because of the datatype checking and flexibility of the methods exposed by the class. If this is a new user, and the data meets your requirements, you would write to the collection in memory, then write the collection to disk to save the file each time a new registration is completed or as the session ends. It might be helpful - if you are up for it - to use the NIO routines and open a channel which would help synchronize the data in memory and in your file stored on more permanent storage.

Similar Threads

  1. wav file fade in out help
    By jase_dukerider in forum C++
    Replies: 2
    Last Post: 04-14-2005, 07:48 PM
  2. Replies: 1
    Last Post: 04-02-2002, 10:45 PM
  3. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 11:45 AM
  4. File uploading / objFile.Write problem
    By Tomer Cagan in forum ASP.NET
    Replies: 1
    Last Post: 07-24-2001, 09:01 AM
  5. Replies: 0
    Last Post: 04-17-2000, 01:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.