struct passwd* getpwuid(uit_t id)
这样,实现起来就超 easy了
引用:#include
#include
#include
#include
int
main()
{
uid_t id;
struct passwd* pbuf;
id=geteuid();
pbuf=getpwuid(id);
printf("%s\n",pbuf->pw_name);
return 0;
}
引用:#include
#include
#include
#include
int
main()
{
uid_t id;
struct passwd* pbuf;
id=geteuid();
pbuf=getpwuid(id);
printf("%s\n",pbuf->pw_name);
return 0;
}