Skip to content

Commit 9144bbd

Browse files
committed
Force output to same dir as input file but with a new name
1 parent 415159f commit 9144bbd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: examples/detector.c

+11
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,17 @@ void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filenam
582582
input = fgets(input, 256, stdin);
583583
if(!input) return;
584584
strtok(input, "\n");
585+
char * new_str ;
586+
if((new_str = malloc(strlen(input)+strlen("pred.png")+1)) != NULL){
587+
new_str[0] = '\0'; // ensures the memory is an empty string
588+
strcat(new_str, input);
589+
strcat(new_str, ".pred.png");
590+
} else {
591+
fprintf(stderr, "malloc failed!\n");
592+
// exit?
593+
}
594+
outfile = new_str;
595+
printf("---- New outfile: %s\n", outfile);
585596
}
586597
image im = load_image_color(input,0,0);
587598
image sized = letterbox_image(im, net->w, net->h);

0 commit comments

Comments
 (0)