Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 5th, 2011  |  syntax: None  |  size: 0.44 KB  |  views: 83  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data