为什么Fortran输出有一个领先的空间? [英] Why does Fortran output have a leading space?
问题描述
leading.f
: program leading
打印*,< - 那是什么空间?
结束程序主导
具有输出
< - 那是什么空间?
(是的,开头有一个空格字符)。我的问题是包含在程序中。
解决方案早在恐龙时代,当FORTRAN输出通常对绿条影响打印机,第一个打印列中的某些字符通常被解释为控制代码(换行符,换页符等)。许多程序员学会明确地将他们输出的第一列空白,除非有一些特殊的效果 - 而旧的习惯很难消失!
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.
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!
这篇关于为什么Fortran输出有一个领先的空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!