By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

How do i Validate code ?

P: 11
Hi all newbie to programming,

I have an assignment to do using the client/server scenario. i have to log on using a user id and password ( both integers), then i have to check that this integers are correct by checking them against a file called CustomerAccounts, if they are correct i am allowed in and if not then an error message is displayed.
Now i can kind of figure how to get the data across and store it but i don't know how to check this with the file as it has to be an exact match and not just within a range.

Obviously as i have stated this is an assignment and i am not looking for someone to do the code for me but a couple of hints on how it could be achieved would be greatly appreciated.

Thank you.
Mar 19 '07 #1
Share this Question
Share on Google+
2 Replies


P: 51
Hi all newbie to programming,

I have an assignment to do using the client/server scenario. i have to log on using a user id and password ( both integers), then i have to check that this integers are correct by checking them against a file called CustomerAccounts, if they are correct i am allowed in and if not then an error message is displayed.
Now i can kind of figure how to get the data across and store it but i don't know how to check this with the file as it has to be an exact match and not just within a range.

Obviously as i have stated this is an assignment and i am not looking for someone to do the code for me but a couple of hints on how it could be achieved would be greatly appreciated.

Thank you.

Hi,
I have an idea and i don't know how far it'll work.

Have the CustomerAccounts file in the format,
username<colon>password <There was a smily being displayed - I have removed it. MODERATOR>
(delimited by colon)

-->In a loop try to read the file line by line.
-->Use strtok function and split the username and password and store them in a separate variables.
-->Then compare those with the scanned input. If any one fails(username or password does not match) give a error message....
-->Use flag variables to set it if matched.

Hope it'll give u some idea...

Regards,
Chella
Mar 19 '07 #2

P: 11
Hi Chella,

Well yeah that kind of makes sense and i can see where your coming from, will give that a go cheers.

Fatboy
Mar 19 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.