Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include?<stdio.h>
- #include?<stdlib.h>
- #include?<string.h>
- #define?MAX_LINE_LEN?1024
- int?main()?{
- ????char?line[MAX_LINE_LEN];
- ????FILE?*in?=?fopen("/etc/passwd",?"r");
- ????if?(!in)?exit(EXIT_FAILURE);
- ????while?(fgets(line,?MAX_LINE_LEN,?in)?!=?NULL)?{
- ????????char?*sep?=?strchr(line,?':');
- ????????if?(!sep)?exit(EXIT_FAILURE);
- ????????*sep?=?'\0';
- ????????printf("%s\n",?line);
- ????}
- ????fclose(in);
- ????return?EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement