Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void cat(FILE* f) {
- int in;
- while((in = getc(f)) != EOF) {
- putchar(in);
- }
- }
- int main(int argc, char** argv) {
- if(argc == 1) {
- cat(stdin);
- }
- else {
- for(int i = 1; i < argc; i++) {
- FILE* f = fopen(argv[i], "r");
- cat(f);
- fclose(f);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement