What do I do wrong?

Charles Quenneville quennevi at IRO.UMontreal.CA
Thu Dec 13 13:30:35 AEST 1990


Hello!

Could you tell me what is wrong with this program? All I'm trying to do
is simply to print the username. 


#include <pwd.h>
#include <stdio.h>

main ()
 {
  struct passwd *pwd;
  struct passwd *getpwent();

  setpwent("/etc/passwd");
  while ((pwd = getpwent()) != 0)
   {
    printf("\n", pwd->pw_name);
    fflush(stdout);
   }
  endpwent("/etc/passwd");
 }
--
    Charles Quenneville
    quennevi at kovic.iro.umontreal.ca

"Ventrebleu, de par ma chandelle verte, j'aime mieux etre gueux



More information about the Comp.unix.questions mailing list