title: How to Read a Line from File in Ocaml?
body: <p>I am in trouble with <code>OCaml</code>, because I want to read the lines from a text file, and I'm using this code to do the job:</p>
  
  <pre><code>    let parse3ac() = 
      let lines = ref "" in
      let chan = open_in "3ac" in
      try
        while true do
          lines := input_line chan;
      print_string(!lines);
        done;
       with End_of_file -&gt; close_in chan;print_string("End Of File");;
  </code></pre>
  
  <p>But it only prints in the console "End Of File", but the lines from the file, doesn't appears.</p>
  
  <p>What is wrong with this code guys?</p>
  
  <p>Thks 4 all!!!</p>
  
  <p>Edited:</p>
  
  <p>Actually I have discovered the reason it isn't working.
  It is very simple, the code above works very well, but the file "3ac" that I had created previously using <code>OCaml</code>, wasn't properly closed, and then it would be impossible to read the file.
  Thanks everybody, and like I said before the code works so everyone can use that.</p>
  
  <p>Thanks .</p>