Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using getpass() in C

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Can anyone please guide me on using getpass() to get a user to login? I would be extremely grateful. Thanks.
 
ok!
a snnipet is as,
#include <stdio.h>
#include <unistd.h>
#include <pwd.h>
#define USER_NAME_SZ 256
int main(void)
{
char u_name[USER_NAME_SZ], *u_pass;
struct passwd *pwd;
printf(&quot;login:&quot;);
gets(u_name);
u_pass=getpass(&quot;passwd:&quot;);
for(;pwd=getpwent();)
{
if(!strcmp(pwd->pw_name, u_name))
{

}
}
return 0;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top