Advertisement
cd62131

Cat lines

Mar 2nd, 2014
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main(int argc, char **argv) {
  4.   FILE *in, *out;
  5.   int c;
  6.   if (argc != 3) exit(1);
  7.   in = fopen(argv[1], "r");
  8.   out = fopen(argv[2], "w");
  9.   while ((c = fgetc(in)) != EOF) {
  10.     if (c != '\n') fputc(c, out);
  11.   }
  12.   return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement