Warning: main(topsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/implementing_who.html on line 13

Warning: main(topsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/implementing_who.html on line 13

Warning: main() [function.include]: Failed opening 'topsc.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eng123/public_html/sourcecode/c/unix/implementing_who.html on line 13


Warning: main(leftsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/implementing_who.html on line 16

Warning: main(leftsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/implementing_who.html on line 16

Warning: main() [function.include]: Failed opening 'leftsc.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eng123/public_html/sourcecode/c/unix/implementing_who.html on line 16

Displaying  Source Code(s)  
 


Warning: main(adsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/implementing_who.html on line 31

Warning: main(adsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/implementing_who.html on line 31

Warning: main() [function.include]: Failed opening 'adsc.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eng123/public_html/sourcecode/c/unix/implementing_who.html on line 31

 
implementing who am i using system calls

--------------------------------------------------------------------------------

Description : This program is used to implement the who am i program using system calls(utmp struture)

#include<stdio.h>
#include<utmp.h>
int main()
{
char *s,*c;
struct utmp *u;
int i;
c=getlogin();
setutent();
u=getutent();
while(u!=NULL)
{
if(u->ut_type==7 && strcmp(u->ut_user,c)==0)
{
printf("%-12s",u->ut_user);
printf("%-9s",u->ut_line);
s=ctime(&u->ut_time);
for(i=4;i<16;i++)
printf("%c",s[i]);
printf("(%s",u->ut_host);
printf(")<BR>);
}
u=getutent();
}
}

 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG