![]() |
CITS2002 Systems Programming |
← prev | next → | ![]() |
![]() |
|||
Another example - accessing a system's password entriesOn a stand-alone Linux system, one not dependent on a network-based server to provide its user information, some local user information is (historically) stored in the textfile /etc/passwd, with each user's information stored one-per-line with fields separated by colons.Rather than expecting every user program to parse this information correctly, Linux systems host standard XOPEN header files and libraries to conveniently provide the information. We can iterate through this information with the help of the getpwent() function, which returns a pointer to a 'struct passwd' structure:
CITS2002 Systems Programming, Lecture 16, p2, 19th September 2023.
|