main() { struct utmp utmp_ent; FILE *fp; fp = fopen(UTMP_FILENAME, "rb"); // fp = fopen(WTMP_FILENAME, "rb"); if(fp) { while(!feof(fp)) { fread(&utmp_ent, sizeof(utmp_ent), 1, fp); if(!strncmp(utmp_ent.ut_name, WHO, strlen(WHO))) { // bzero((char *)&utmp_ent, sizeof(utmp_ent)); fseek(fp, -(sizeof(utmp_ent)), SEEK_CUR); printf("%s\n", utmp_ent.ut_name); } } } }