f15e
04-04-2002, 09:59 PM
I am writing a program that gets a login ID from a user and then a password. Within a file is login ID's and its password in this form:
abc1234 logcabin
def5678 computer
etc.........
I will open the file, inFile.open("idfile.txt"); I have already prompted the user to enter their login ID and password. Now I want to search the file to validate that the ID and password is within the idfile file. What do I use to search a file for the matching ID and password until it is either found or not found in which case I will display a message to the user that the info. was invalid.
Would I use getline() or whatever function and a loop until the ID and password is found?
What is the best thing to use to search a file until whatever you are looking for is found?
abc1234 logcabin
def5678 computer
etc.........
I will open the file, inFile.open("idfile.txt"); I have already prompted the user to enter their login ID and password. Now I want to search the file to validate that the ID and password is within the idfile file. What do I use to search a file for the matching ID and password until it is either found or not found in which case I will display a message to the user that the info. was invalid.
Would I use getline() or whatever function and a loop until the ID and password is found?
What is the best thing to use to search a file until whatever you are looking for is found?