在 Fortran 中读取可变长度/类型行
我有一行 Fortran 数据,我需要读入不同的值。值的数量可以是任何值,类型也可以是任何值。示例
0.45 1 T F
或
0.45 1 T 2.45 18.0 45.2
如何成功读取这一行,或者至少将其分解为基本标记,而不获取下一行信息(必须不惜一切代价防止这种情况)。
I have a row of data in fortran, and I need to read in the different values. The number of values can be anything, and the type as well. Examples
0.45 1 T F
or
0.45 1 T 2.45 18.0 45.2
how can I read successfully this row, or at least decompose it in its fundamentals tokens, without fetching the next line information (this must be prevented at all costs).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将整行读入字符类型的变量中,然后对字符变量执行任何您想要的操作,然后读取下一行,依此类推。
You can read the entire row into a variable of type character, then you do whatever you want with the character variable, then read the next row and so forth.