Simplify file copying
Also enlarge buffers.
This commit is contained in:
parent
42f2334450
commit
f277db6c7e
6
main.c
6
main.c
|
@ -54,7 +54,7 @@ cleanup()
|
||||||
FILE *
|
FILE *
|
||||||
cpyfile(const char *src, const char *tgt)
|
cpyfile(const char *src, const char *tgt)
|
||||||
{ FILE *inp, *out;
|
{ FILE *inp, *out;
|
||||||
char buf[1024];
|
char buf[4096];
|
||||||
|
|
||||||
inp = fopen(src, "r");
|
inp = fopen(src, "r");
|
||||||
out = fopen(tgt, "w");
|
out = fopen(tgt, "w");
|
||||||
|
@ -62,8 +62,8 @@ cpyfile(const char *src, const char *tgt)
|
||||||
{ printf("ltl2ba: cannot cp %s to %s\n", src, tgt);
|
{ printf("ltl2ba: cannot cp %s to %s\n", src, tgt);
|
||||||
alldone(1);
|
alldone(1);
|
||||||
}
|
}
|
||||||
while (fgets(buf, 1024, inp))
|
while (fgets(buf, sizeof buf, inp))
|
||||||
fprintf(out, "%s", buf);
|
fputs(buf, out);
|
||||||
fclose(inp);
|
fclose(inp);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue