DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2007
    Posts
    4

    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
    Location
    Sterling Heights, Michigan
    Posts
    8,652
    Have a look at this thread.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    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

Bookmarks

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links