Check if input file could be opened.

This commit is contained in:
Jochen Topf 2014-03-11 11:24:18 +01:00
parent f0da31fd79
commit 3c7756e965
1 changed files with 4 additions and 0 deletions

View File

@ -126,6 +126,10 @@ int main(int argc, char *argv[]) {
// open specified file
FILE *fp = fopen(argv[optind], "rb");
if (!fp) {
err("can't open file '%s'", argv[optind]);
}
// read while the file has not reached its end
while (!feof(fp)) {
// storage of size, used multiple times