title: PostScript - from file to file
body: <p>Cheers,</p>
  
  <p>I'm trying to read char by char from a file using PostScript and then writing them to another.</p>
  
  <p>I can push all the chars to the stack doing:</p>
  
  <pre><code>(inputFile)(r)file 1 string readstring
  </code></pre>
  
  <p>But now I can't write the chars to the other file. I tried</p>
  
  <pre><code>(outputFile)(w)file = writestring
  </code></pre>
  
  <p>and other methods, but none seems to work.</p>
  
  <p>EDIT: code</p>
  
  <pre><code>/infile (text.txt) (r) file def % open files and save file objects
  /outfile (output.txt) (w) file def
  /buff 1 string def % your buffer for reading operations
  { % loop
      infile buff readstring
      { %ifelse
           outfile (&gt;) writestring
           outfile exch writestring
           outfile (&lt;) writestring
           outfile (\n) writestring
  
      }
      { %else
  
              exit % exit the loop
      } ifelse
  } bind loop
  </code></pre>
  
  <p>Every char gets > and &lt; , but they still on the same line</p>
  
  <p>EDIT: found the problem : The output file CAN NOT have .txt entension</p>
  
  <p>Best regards</p>