Why does Fortran output have a leading space?

2019-06-21 03:04发布

I process lots of output from Fortran programs, and it generally appears that the output from these programs has a leading space, i.e., character column 1 is blank. Consider a short program leading.f:

      program leading
      print *, "<-- What's that space for?"
      end program leading

Has the output

 <-- What's that space for?

(yes, there is one space character at the beginning). My question is contained in the program.

1条回答
Animai°情兽
2楼-- · 2019-06-21 03:30

Back in the dinosaur era, when FORTRAN output usually went to a green-bar impact printer, certain characters in the first print column were often interpreted as control codes (line feeds, form feeds, etc). Many programmers learned to explicitly blank column 1 of their output, unless some special effect was intended -- and old habits die hard!

查看更多
登录 后发表回答