formatting - 抑制 Fortran 95 写入语句中的换行符

我想在 fortran 中写入标准输出而不添加换行符。也就是说,我想做这样的事情:

a='some string and '
b='some other string'
write(*,101) a
...
write(*,102) b
...
101 format(a,...)
102 format(a)

是否可以使用某种格式语句来抑制 101 中的换行符,使得代码在同一输出行上输出“some string and some other string”?

请注意,将两个 write 语句分开很重要,因为中间的代码实际上用于生成第二个字符串。

最佳答案

您可以使用 advance='no' 选项:

a='some string and '
b='some other string'
write(*,101,advance='no') a
...
write(*,102) b
...
101 format(a)
102 format(a)

这将抑制换行。

https://stackoverflow.com/questions/661975/

相关文章:

r - 如何在不丢失行名和列名的情况下对 R 中的平面列联表进行子集化?

bash - UNIX 统计时间格式

python - 设置 ipython 的默认科学记数法阈值

asp.net-mvc - 电话号码或社会保险号的 DisplayFormat.DataFormat

python - 将任意文本格式化为漂亮的 HTML 的 Python 模块的名称是什么?

vim - 在 Vim 中轻松将函数参数重新格式化为多行

eclipse - 如何配置 Eclipse 格式化程序在字段声明之间不插入空行?

java - 是否可以在 Eclipse 中将部分 java 代码标记为不自动格式化?

android - HTML.fromHtml 换行符消失

floating-point - 如何格式化具有特定精度和前置零的 f32?