0

I am making a program in which a user has to enter his username and password inorder to access the main program.....i am making the user enter the password using the getpass function and i have included the necessary headerfiles i.e. <conio.h>

do
	{
		cout<<"\n\n SIGN IN \t\t";
		cout<<"\n\n\n Username \t\t"; gets(uname);
		while(!f.eof())
		{
			pos=f.tellg();
			f.read((char*)&u,sizeof(u));
			if(strcmp(uname,u.getuname())==0)
			{
				found=1;
				char*pass;
				pass=getpass("\n\n Password \t\t");
				if(strcmp(pass,u.getpswrd())==0)
				cout<<"\n\n You may Proceed \t";
				else
				{
					cout<<"\n\n Incorrect Password \t\t";
					break;
				}

the following errors appear

call to undefined function getpass
cannot convert "int" to "char*" in function sign_in()[the name of the function]

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by jonsca
0

Never use gets for input, you can overrun the end of your input buffer and crash your program, etc. Use fgets instead, if you must use the C library functions.

I'm having a hard time understanding how the snippet you posted relates to either getpass or sign_in (I get that you call getpass in it but where is it defined?)

(this sounds harsh but I really didn't intend it that way at all)

Edited by jonsca: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.