add changes to sqlite_ex and some new files
This commit is contained in:
27
cat_v1.c
Normal file
27
cat_v1.c
Normal file
@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void filecopy(FILE *, FILE *);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
FILE *file_p;
|
||||
|
||||
if (argc == 1)
|
||||
filecopy(stdin, stdout);
|
||||
else
|
||||
while (--argc > 0)
|
||||
if ((file_p = fopen(*++argv, "r")) == NULL) {
|
||||
printf("cat: can't open: %s\n", *argv);
|
||||
return 1;
|
||||
} else {
|
||||
filecopy(file_p, stdout);
|
||||
fclose(file_p);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void filecopy(FILE* in_file_p, FILE* out_file_p) {
|
||||
int ch;
|
||||
|
||||
while((ch = getc(in_file_p)) != EOF)
|
||||
putc(ch, out_file_p);
|
||||
}
|
Reference in New Issue
Block a user