Fix non-stream file copying
This commit is contained in:
parent
71fe51ec14
commit
481a87de6d
7
main.c
7
main.c
|
@ -99,8 +99,11 @@ int fn(const char* fpath, const struct stat* sb, int typeflag)
|
||||||
uint8_t buffer[BUFFER_SIZE];
|
uint8_t buffer[BUFFER_SIZE];
|
||||||
FILE* from = fopen(fpath, "rb");
|
FILE* from = fopen(fpath, "rb");
|
||||||
FILE* to = fopen(output_entry, "wb");
|
FILE* to = fopen(output_entry, "wb");
|
||||||
size_t bytes_read = fread(buffer, 1, BUFFER_SIZE, from);
|
size_t bytes_read = 0;
|
||||||
fwrite(buffer, 1, bytes_read, to);
|
while((bytes_read = fread(buffer, 1, BUFFER_SIZE, from)) > 0)
|
||||||
|
{
|
||||||
|
fwrite(buffer, 1, bytes_read, to);
|
||||||
|
}
|
||||||
fclose(to);
|
fclose(to);
|
||||||
fclose(from);
|
fclose(from);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue