Complies, runs, outputs to file but program hangs (infinite loop somewhere).