getpwent函数

#include 
#include 

int
main()
{
    struct passwd * pw_Ptr ;
    while((pw_Ptr = getpwent()) != NULL){
        printf("%s:",pw_Ptr->pw_name);
        printf("%s:",pw_Ptr->pw_passwd);
        printf("%u:",pw_Ptr->pw_uid);
        printf("%u:",pw_Ptr->pw_gid);
        printf("%s:",pw_Ptr->pw_gecos);
        printf("%s:",pw_Ptr->pw_dir);
        printf("%s",pw_Ptr->pw_shell);
        printf("\n");
    }
    endpwent();
    return(0);
}

 

你可能感兴趣的:(C,linux)