0

You would have seen this message when you telnet to an unix machine, it displays
last login from <ip address> message
What is the sytem command for displaying the same ? Can I code it in C++ without using system command ?

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Paul.Esson
0

Hey,

There is a lastlog command in unix that displays the contents of the /var/log/lastlog file, This is a binary file and a structure describing the contents is located in the <bits/utmp.h> header file

struct lastlog
{
#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
int32_t ll_time;
#else
__time_t ll_time;
#endif
char ll_line[UT_LINESIZE];
char ll_host[UT_HOSTSIZE];
};

anyhow more useful is prolly this example of a lastlog editor written in C that can be found here

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.