为什么Fortran输出有一个领先的空间? [英] Why does Fortran output have a leading space?

查看:153
本文介绍了为什么Fortran输出有一个领先的空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我处理大量来自Fortran程序的输出,一般看来这些程序的输出有一个前导空间,即字符列1是空白的。考虑一个简短的程序 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆