title: Can't access a file in Prolog
body: <p>I am studying Prolog using SWI-Prolog.</p>
  
  <p>I am finding some problems with the following example that simply access to a file and write in it what the user put in the Prolog Shell.</p>
  
  <pre><code>processFile(File) :- see(File),
                   processFile,
                   seen.
  
  processFile :- read(Query),
                 process(Query).
  
  process(end_of_file) :- !.
  
  process(Query) :- Query,
                    write(Query),
                nl,
                processFile.
  </code></pre>
  
  <p>The problem is that when, in the Prolog shell, I try to execute the processFile statement with a file name I obtain an error:</p>
  
  <p>If I give a file name with an extension I obtain this error message (seems to interpret the extension as an operator):</p>
  
  <pre><code>7 ?- processFile(myFile.txt).
  ERROR: Syntax error: Operator expected
  ERROR: processFile(myFile
  ERROR: ** here **
  ERROR: .txt) . 
  </code></pre>
  
  <p>If I give a file name without extension I obtain this other error message (the file don't exist):</p>
  
  <pre><code>7 ?- processFile(myFile).
  ERROR: see/1: source_sink `myFile' does not exist (No such file or directory)
  </code></pre>
  
  <p>So I have also try to create a new file named <strong>myFile</strong> (without extension) in the same folder where is the prolog source code file but I still again obtain:</p>
  
  <pre><code>8 ?- processFile(myFile).
  ERROR: see/1: source_sink `myFile' does not exist (No such file or directory)
  </code></pre>
  
  <p>Why? where is the error? How can I solve it?</p>