Check if output file actually opened, closes #1
This commit is contained in:
parent
b5904455de
commit
5b62521df0
|
@ -65,8 +65,12 @@ int main(int argc, char* argv[]) {
|
|||
pos = strstr(pos, "777");
|
||||
}
|
||||
FILE* output_file = fopen(argv[2], "w");
|
||||
if (output_file == NULL) {
|
||||
fprintf(stderr, "Error opening output file");
|
||||
} else {
|
||||
fwrite(input_file -> contents, sizeof(char), input_file -> size_of_file, output_file);
|
||||
fclose(output_file);
|
||||
}
|
||||
close_file(input_file);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue