C program to see user log on in system and print user with real user name also
WHAT IS WRONG WID THIS PROGRAM
#include <sys/types.h> #include <utmp.h> #include <pwd.h> #include <stdio.h> int main(int argc, char *argv[]){ struct passwd *buffer; struct utmp *naveen; { while((buffer=getpwent()!=NULL)) printf("%s", buffer->pw_gecos); printf("%s", naveen->ut_user); } } |
You need to call getutid() on the utmp file to get information about that user's last login. Also your while loop "isn't" whar you think.
Code:
#include <sys/types.h> |
jim i didnt get you dude. Can you please show it
|
All times are GMT -5. The time now is 10:43 PM. |