title: Fortran: "output statement overflows record" error when naming output files
body: <p>I'm trying to write dynamically to different file names (e.g. "output_0001.txt" "output_0002.txt"), but repeatedly get the following error:</p>
  
  <pre><code>forrtl: severe (66): output statement overflows record, unit -5, file
  Internal Formatted Write
  </code></pre>
  
  <p>I've tried extending my "filename" character array to excessively large lengths, but it still isn't working. No idea why my string would be too big frown emoticon If I change the "filename" to a static character array, then it works fine. Any ideas?</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>character(30)::filename
  ...
  write(filename, fmt = "(2A, I0.4, A)") out_file_basename, "_", i, ".dat"
  open(unit = 3, file = filename)
  </code></pre>