title: Trimming string for directory path
body: <p>I'm trying to create the full path of a file, entering the parent folder in via a <code>Read</code> statement:</p>
  
  <pre><code>PROGRAM fileTest
  
    IMPLICIT NONE
  
    Character(LEN=20) :: dirpath,fullpath
  
    Write(6,*) 'Enter dir path'
    Read(*,'(a)') dirpath
    dirpath=TRIM(dirpath)
    fullpath=dirpath//'/file.abc'
    print*,fullpath
  
  END PROGRAM fileTest
  </code></pre>
  
  <p>Using gfortran, the code compiles, but entering <code>/home/chris</code> results in the final print statement still giving</p>
  
  <pre><code>/home/chris         /file.abc
  </code></pre>
  
  <p>(note the 9 characters of whitespace).</p>
  
  <p>How do I get rid of the spurious whitespaces?!</p>