You need to use an endl (or at least a flush) after printing the "executed 0;" string, otherwise you may not see it. In other words, it's probably not stopping at the getline, but a little later on (either with the diff_chars access or with the print_line function).
BTW, "undefined behavior" can work on one system and not work on another (or even potentially with a compiler update). The proper way to call openfiles is something like I've shown.