To get the Userid..

I am working in an unix based environ.(gcc), i need to get
the userid/loginname without using the system(), is there
any in-built function to get it. hope you got the question.

--begin
beginAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
maxkirConnect With a Mentor Commented:
#include <pwd.h>

getuid() - get user id
getpwuid(uid) - get info about user from passwd file.
0
 
beginAuthor Commented:
thanks, additionally how could i get the loginname which i am currently logged in.
--begin
0
 
ozoCommented:
#include <unistd.h>
getlogin()
0
All Courses

From novice to tech pro — start learning today.