diff --git a/src/main.ml b/src/main.ml index e4e38b8..3b40def 100644 --- a/src/main.ml +++ b/src/main.ml @@ -133,7 +133,14 @@ let _ = else ( if !nopopt then (fun _ -> ()) - else Format.printf "%a" Ast_to_c.ast_to_c) + else + ( + let oc = open_out !output_file in + let fmt = Format.make_formatter + (Stdlib.output_substring oc) + (fun () -> Stdlib.flush oc) in + Format.fprintf fmt "%a" Ast_to_c.ast_to_c); + ) end end