25 lines
439 B
C
25 lines
439 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#define SZBUF 256
|
|
int main(int argc, char *argv[]){
|
|
int fs, n;
|
|
char buf[SZBUF];
|
|
if (argc < 2){
|
|
fprintf(stderr, "Usage : %s <SRC_FILE>\n", argv[0]);
|
|
exit(1);
|
|
}
|
|
fs = open(argv[1], O_RDONLY);
|
|
if (fs == -1){
|
|
perror("File opening fails");
|
|
exit(2);
|
|
}
|
|
while (n = read(fs, buf, SZBUF))
|
|
write(1, buf, n);
|
|
close(fs);
|
|
exit(0);
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|