[RESOLVED] Write to the SECOND line in a text file?
Hello, I'm kind of troubled by this. How do I write to the second line of the text file? I'm using this code, to add encrypted text (in hex) to line one, and read it and validate it. I need to know how to add it to line 2, 3, 4, ect. Thank you for your help.
The bottom calls the top code, to add "Username" and "Password" encrypted in hex, on the first line of a text file. I need to be able to add it to the second line so I could do something like:
VB Code:
Form_Load()
Call addpw
user(0) = "Username"
pass(0) = "Password"
user(1) = "Username1"
pass(1) = "Password1"
user(2) = "Username2"
pass(2) = "Password2"
End Sub
I think you get the point, thanks alot guys
Also, once I have that done, how would I get it to check not only the first line, but the second one too, to validate it.
Last edited by Echo{tWe}; Jun 11th, 2005 at 09:12 PM.
If you change the output to an append, it will write each password combination to the end of the password file, encrypted. When you are reading it back, you could read the whole file into a buffer, and split it on the vbCrLf, which would tell you how many user names that you have.
I would have a tUser as String and tPassword as string when they are entering the info. That way you could loop if tuser = user(x) and tpassword = password(x) for each password in the file.
If you change the output to an append, it will write each password combination to the end of the password file, encrypted. When you are reading it back, you could read the whole file into a buffer, and split it on the vbCrLf, which would tell you how many user names that you have.
I would have a tUser as String and tPassword as string when they are entering the info. That way you could loop if tuser = user(x) and tpassword = password(x) for each password in the file.
Wow, I have no clue how to do that. Think you can show me an example?
Here is how to append the passwords and not keep overwriting the same one
You really can't make an app by just copy paste someone elses app, because they usually have different requirements. This one came from someone adding a password to their school assignment, and only needed one set of credentials. I would do things differently for more than one
I maade some changes to that app so that it would work with more than one user. the problem is that there is no main for that calls new password generation. i added David/Password and test/test. They both work
Last edited by dglienna; Jun 11th, 2005 at 01:30 PM.
Here is how to append the passwords and not keep overwriting the same one
You really can't make an app by just copy paste someone elses app, because they usually have different requirements. This one came from someone adding a password to their school assignment, and only needed one set of credentials. I would do things differently for more than one
I maade some changes to that app so that it would work with more than one user. the problem is that there is no main for that calls new password generation. i added David/Password and test/test. They both work
EDIT: Actually, it isn't working. test/test worked, but not David/Password, I tried some other combos too, but they failed.
Last edited by Echo{tWe}; Jun 11th, 2005 at 07:01 PM.
Hmmm. I guess I should have tested better. Change these two lines:
It was only testing the last one, and I had tested the other two earlier.
Username/Password was the first one
VB Code:
user(idx) = HexToStr(xline(0))
pass(idx) = HexToStr(xline(1))
idx = idx + 1
It was using j, which was 0 each time. Also, you can delete the j% from the declaration so it's like this:
Hmmm. I guess I should have tested better. Change these two lines:
It was only testing the last one, and I had tested the other two earlier.
Username/Password was the first one
VB Code:
user(idx) = HexToStr(xline(0))
pass(idx) = HexToStr(xline(1))
idx = idx + 1
It was using j, which was 0 each time. Also, you can delete the j% from the declaration so it's like this:
VB Code:
Dim i%, ff%, idx%
I tryed changing it, still didn't work. I may have done it wrong, see if it works for you, if it does, could you upload it?