Results 1 to 2 of 2

Thread: Unable to login

  1. #1
    PerryCollins is offline Senior Member
    Join Date
    Dec 2009
    Posts
    380
    Rep Power
    3

    Default Unable to login

    Unable to login using fstream

    I am learning C++ programming language. Using fstream I have created one login program. In this program I store my all data in a text file. When I open that file I see somewhat like:

    usernameassword:level
    when I tried to get back the data from this file I get following error.
    ifstream login(FileName);
    login >> username >> password >> level; I will unable to get appropriate result. I get following result.
    Username = usernameassword:level
    password = null
    level = null
    I do not understand why I not able to login using fstream. Any help would be highy appericated.

  2. #2
    SmithJohnson is offline Senior Member
    Join Date
    Dec 2009
    Posts
    364
    Rep Power
    3

    Default

    Using following code in your program you can solve your problem. You have to first import that file into your program and after that you have to get back all information like Username, Password and level. Just follow the code.

    ifstream login("filename");
    login.open("filename");
    getline(login,username,':');
    getline(login,password,':');
    getline(login,level,':');
    login.close();
    Last edited by nitesh14; 02-06-2010 at 03:26 PM.

Similar Threads

  1. Unable to show Login Password Box
    By TorresScott in forum other peripherals
    Replies: 1
    Last Post: 04-01-2010, 03:36 PM
  2. unable to login windows XP professional password
    By CoxWatson in forum Windows XP
    Replies: 1
    Last Post: 03-18-2010, 06:39 AM
  3. Login to DC from Internet
    By PerezMorris in forum General Internet Terms
    Replies: 1
    Last Post: 03-04-2010, 01:30 PM
  4. Login Name
    By Charley Dumas in forum General Internet Terms
    Replies: 0
    Last Post: 10-30-2009, 12:32 PM
  5. Unable to Login
    By haqar.uakra in forum Web. 2.0
    Replies: 0
    Last Post: 07-01-2008, 11:15 AM

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
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48