}
if (optarg != nullptr) {
- FILE *fp = fopen(optarg, "r");
- if (fp != nullptr) {
- fseek(fp, 0L, SEEK_END);
- input[input_idx].size = ftell(fp);
- fseek(fp, 0L, SEEK_SET);
+ FILE *input_fp = fopen(optarg, "r");
+ if (input_fp != nullptr) {
+ fseek(input_fp, 0L, SEEK_END);
+ input[input_idx].size = ftell(input_fp);
+ fseek(input_fp, 0L, SEEK_SET);
input[input_idx].data = malloc(input[input_idx].size);
if (input[input_idx].data == nullptr) {
char errMsg[80] = { '\0' };
fprintf(stderr, "malloc: %s\n", strerror_r(errno, errMsg, sizeof(errMsg)));
} else {
- if (fread(input[input_idx].data, input[input_idx].size, 1, fp) != 1) {
+ if (fread(input[input_idx].data, input[input_idx].size, 1, input_fp) != 1) {
char errMsg[80] = { '\0' };
- fprintf(stderr, "fread: %s\n", strerror_r(ferror(fp), errMsg, sizeof(errMsg)));
+ fprintf(stderr, "fread: %s\n", strerror_r(ferror(input_fp), errMsg, sizeof(errMsg)));
_exit(EIO);
}
}
- if (fclose(fp) < 0) {
+ if (fclose(input_fp) < 0) {
char errMsg[80] = { '\0' };
fprintf(stderr, "Unable to close the file pointer: %s\n", strerror_r(errno, errMsg, sizeof(errMsg)));
+ _exit(EIO);
}
}
}
printf("Incorrect Model file\n");
result = false;
}
+ model_check.close();
+
std::ifstream input_check(input_tensor_path_);
if (input_check.good() == false) {
printf("Incorrect Input file\n");
result = false;
}
+ input_check.close();
printf("Model File : %s \n", model_file_path_.c_str());
printf("Input File : %s \n", input_tensor_path_.c_str());
printf("Incorrect Model file\n");
result = false;
}
+ model_check.close();
+
std::ifstream input_check(input_image_path_);
if (input_check.good() == false) {
printf("Incorrect Input Image file\n");
result = false;
}
+ input_check.close();
+
std::ifstream output_check(output_label_path_);
if (output_check.good() == false) {
printf("Incorrect Output Label file\n");
result = false;
}
+ output_check.close();
if (LoadLabels() == false) {
printf("Failed to load labels\n");