.TH getutent() "" "" "General Function (libc)"
.PC "Read an entry from a login logging file"
.B "#include <utmp.h>"
\fBstruct utmp *getutent()\fR
.PP
.II utmp
.B getutent()
reads the next entry from the file that holds login information.
If the file is not open,
.B getutent()
opens it.
By default,
.B getutent()
reads file
.BR /etc/utmp .
To change this, call
.BR utmpname() .
.PP
.B getutent()
returns the address of the record it has read from the login file.
This object has type
.BR utmp ,
which is defined in header file
.BR <utmp.h> ;
for a detailed description of this structure, see the Lexicon entry for
.BR utmp.h .
.B getutent()
returns NULL if it cannot open the login file, or when it attempts to read
past the end of the file.
.SH "See Also"
.Xr "libc," libc
.Xr "utmp.h" utmp.h
.SH Notes
.B getutent()
writes its
.B utmp
record into a static portion of memory,
which it overwrites the next time it is called.
Therefore, if you wish to save
.B utmp
record, you must copy it into a portion of memory that you define before
you again call
.BR getutent() .
