title: How to read all the Prolog predicate in a .txt file using read predicate in Prolog?
body: <p>I am learning Prolog using SWI Prolog. Consider the situation in which I have a file named <strong>myFile.txt</strong> that contains the following content:</p>
  
  <pre><code>line1.
  line2.
  line3.
  </code></pre>
  
  <p>Now I am trying to create a predicate that using the <strong>read</strong> predicate have to read the content of this file, I have create the following predicate:</p>
  
  <pre><code>readFileSee(InputFile) :- seeing(OldStream),
                            see(InputFile),
                            read(Term),
                            write(Term),
                            seen,
                            see(OldStream).
  </code></pre>
  
  <p>The problem is that, when I execute this program, I obtain only the first line. For example if I launch this statement I obtain:</p>
  
  <pre><code>?- readFileSee('/home/andrea/Documenti/prolog/lezione6/project/myFile.txt').
  line1
  true.
  </code></pre>
  
  <p>The <strong>read</strong> predicate read <strong>Prolog terms</strong> but why read only the first terms? What can I do to let it read all the terms contained in the file? Can I do it using <strong>read</strong> predicate?</p>