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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with struct passwd...

Status
Not open for further replies.

GooMooPunch

Programmer
Jan 26, 2004
5
US
Hello,

I'm trying to print out the user's name, but am receiving an error:
------
struct passwd* user = getpwuid(getuid());

printf("\n %s \n", user.pw_name);

---------
the error I receive is:

request for member "pw_name" in something not a structure or union
-----

I'm not quite sure why this is happening...what can I do to print out the pw_name from the passwd structure?

Thanks

 
It's a pointer to a struct, so

Code:
printf("\n %s \n", user->pw_name);


--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top