Advertisement
Guest User

Untitled

a guest
Jun 5th, 2011
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include?<stdio.h>
  2. #include?<stdlib.h>
  3. #include?<string.h>
  4. #define?MAX_LINE_LEN?1024
  5. int?main()?{
  6. ????char?line[MAX_LINE_LEN];
  7. ????FILE?*in?=?fopen("/etc/passwd",?"r");
  8. ????if?(!in)?exit(EXIT_FAILURE);
  9. ????while?(fgets(line,?MAX_LINE_LEN,?in)?!=?NULL)?{
  10. ????????char?*sep?=?strchr(line,?':');
  11. ????????if?(!sep)?exit(EXIT_FAILURE);
  12. ????????*sep?=?'\0';
  13. ????????printf("%s\n",?line);
  14. ????}
  15. ????fclose(in);
  16. ????return?EXIT_SUCCESS;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement