Created
May 21, 2017 20:23
-
-
Save pat36/d991eda0c270ed823a5d83c274c6157c to your computer and use it in GitHub Desktop.
My simple implementation of cat program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char *argv[]) { | |
if(argc != 2) return -1; | |
FILE* fp; | |
char c; | |
fp = fopen(argv[1], "r"); | |
while((c = getc(fp)) != EOF) | |
printf("%c", c); | |
fclose(fp); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment