473,386 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

C++ code for password entry

18
Hi,
I'm a newbie in c++...Can anyone provide me with the C++ code for entering the password...It should be in this way..
The user enters the password but only *'s should be displayed...Assume that there is a flat file which contains the details of users and their respective passwords. Authentication should be provided after checking the file...

Its urgent..Thanks in advance...
Regards
vijay
Oct 22 '07 #1
3 6396
Meetee
931 Expert Mod 512MB
Hi,
I'm a newbie in c++...Can anyone provide me with the C++ code for entering the password...It should be in this way..
The user enters the password but only *'s should be displayed...Assume that there is a flat file which contains the details of users and their respective passwords. Authentication should be provided after checking the file...

Its urgent..Thanks in advance...
Regards
vijay
Hi Vijay,

Welcome to TSDN. What have you done so far? We cannot provide you direct code as per posting guidelines. Kindly post your perticular problem and paste your efforts in code tags so that we can help you.

Google is a friend always!

Regards
Oct 22 '07 #2
ashitpro
542 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3. int main()
  4. {
  5.    char ch;
  6.    char pass[20];
  7.    int i=0;
  8.  while((ch=getch())!=13 && i < 20) //13 is ascii value for "Enter" key, I am not sure.
  9.  {
  10.        printf("*");
  11.        pass[i++]=ch;
  12.  }
  13. //here pass will contain your password.
  14. }
  15.  
This code will work if you have conio.h file.
On posix platform probably you need to download "kbhit" and use kbhit instead of getch in above code.
Oct 22 '07 #3
sicarie
4,677 Expert Mod 4TB
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3. int main()
  4. {
  5.    char ch;
  6.    char pass[20];
  7.    int i=0;
  8.  while((ch=getch())!=13 && i < 20) //13 is ascii value for "Enter" key, I am not sure.
  9.  {
  10.        printf("*");
  11.        pass[i++]=ch;
  12.  }
  13. //here pass will contain your password.
  14. }
  15.  
This code will work if you have conio.h file.
On posix platform probably you need to download "kbhit" and use kbhit instead of getch in above code.
A note on the above - using conio.h means that you are using a non standard header and this will not work on all machines. If you are going to deploy this to a mass number of machines, I would recommend thorough testing to make sure they are all compatible, or finding another method of implementation.

@ashitpro - you are a member now, and thus expected to know when and how to use code tags. If you need to, please review when and how to use code tags.
Oct 22 '07 #4

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

Similar topics

4
by: Tim Daneliuk | last post by:
OK, I've Googled for this and cannot seem to quite find what I need. So, I turn to the Gentle Geniuses here for help. Here is what I need to do from within a script: Given a username and a...
0
by: Robert Adrian | last post by:
I am attempting to retrieve the bad password count from active directory. However, the results seem to be incorrect. Any help with this would be appreciated. Robert Adrian Raven Inc. Public...
2
by: Jimi Ffondu | last post by:
Hi there - it's pretty simple, and I'm an idiot. I'm not a developer, I just seem to have landed in this job building this Access database - I've got two days to make it work... aaahh! 1) ...
8
by: VB Programmer | last post by:
I would appreciate your assistance on this ASP.NET 2.0 site.... This is the wierd problem: While accessing the built in .NET functions for 'profiling' or 'membership' an error is generated (see...
6
by: clusardi2k | last post by:
Hello again, I have to go home and read up on Access. But, I have read else-where in this newsgroup that I can just save the password in the database under scrutiny. Wouldn't it be wasteful...
2
by: Bart Van der Donck | last post by:
Hello, I'm posting the software for one-FAQ-a-day as described on http://tinyurl.com/qcxw7 (comp.lang.javascript, July 18 2006, titled "CLJ newsgroup FAQ) and on http://tinyurl.com/ppt2s...
3
by: Saqib Ali | last post by:
is there a way to enforce password history verification when using Directory.Entry.Invoke("SetPassword", newPasswdStr)??? saqib http://www.full-disk-encryption.net
3
by: %NAME% | last post by:
When using embedded SQL for db2 under solaris, you do not need to give username and password since the system will use your unix-login as default credential. However, with JDBC seems I always need...
3
by: Faisal Shah | last post by:
As the solution.. I have got this script code.. it's an open source so i can modify it.. The problem is it's a guest book script written in very highly and deeply php language that I am not able...
15
by: colemanj4 | last post by:
Here is what I have so far, it loops while the PW is incorrect, or until cancel is selected. I want it to lock the tables for adds, deletes, and edits when cancel is selected, and if the PW is...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.