blob: 41768eaefa31c5191ce8595a6edf2a9556818cc5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
// Input (default stdin)
FILE *in=stdin;
// Output
FILE *out=stdout;
// In case a Filename was supplied
if(argc>1){
char buf[256];
// Relative Path
if(argv[1][0]!='/')
{
sprintf(buf,"%s/%s",getenv("PWD"),argv[1]);
in=fopen(buf,"r");
}
// Absolute Path
else
{
in=fopen(argv[1],"r");
}
}
char buf[256];
while(1)
{
int l=fread(buf,1,255,in);
buf[l]=0;
if(l==0)break;
fwrite(buf,1,l,out);
}
return EXIT_SUCCESS;
}
|