getopt(_long) permutes the arguments in argv in such a way, that when there are no arguments it understands left (when it returns -1) all the parsed arguments are before the unparsed ones. So you can use the global variable optind, which getopt sets to the index of the first argument in argv, which it did not parse in order to find any additional arguments to your program. Supposing that except the arguments known by getopt there is one such some_other_file, the pseudocode would be:
while ((ret = getopt_long(argc, argv, ...)) != -1) {
/* do something with ret */
}
if (optind >= argc) {
/* error, no some_other_file */
} else {
file_str = argv[optind];
/* do something else */
}
This method can be extended to an arbitrary number of no-hyphen arguments, which are guaranteed to be all left in argv in order they were passed to the program, and all of them after any arguments understood by getopt, so a simple loop from optind to argc-1 can be used to list these unparsed arguments.