Advertisement
cd62131

Cat

Mar 16th, 2014
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(int argc, const char * argv[]) {
  3.   int c;
  4.   if (argc > 1) {
  5.     if (freopen(argv[1], "r", stdin) == NULL) {
  6.       perror(argv[1]);
  7.       return 1;
  8.     }
  9.   }
  10.   while ((c = getchar()) != EOF && putchar(c))
  11.     ;
  12.   return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement