ok, I think I just figured out what the issue was. I'm opening "example.txt" twice in main(). When I removed the second line, the results started being written to the file.
Removing
outputFile.open("example.txt");
led to the results being written to the file.