Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

40. Login Accounting > Retrieving Information from the utmp and wtmp Files

Retrieving Information from the utmp and wtmp Files

The functions described in this section retrieve records from files containing utmpx-format records. By default, these functions use the standard utmp file, but this can be changed using the utmpxname() function (described below).

These functions employ the notion of a current location within the file from which they are retrieving records. This location is updated by each function.

The setutxent() function rewinds the utmp file to the beginning.

#include <utmpx.h>

void setutxent(void);

Normally, we should call setutxent() before employing any of the getutx*() functions (described below). This prevents possible confusion that might result if some third-party function that we have called has previously made use of these functions. Depending on the task being performed, it may also be necessary to call setutxent() again at appropriate points later in a program.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint