Why does Fortran output have a leading space?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 09:55:07

问题


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:


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!



来源:https://stackoverflow.com/questions/10627626/why-does-fortran-output-have-a-leading-space

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!