Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
问题:在单行上读取具有多个条目的数据文件
~~~~~~~~~~~~
该解决方案的问题:
有没有其他方法可以做到这一点?
使用延迟长度字符和非高级读取可以避免您在问题中提到的问题。
继续使用具有显式格式的内部 IO 解析结果行,避免了与列表定向格式的更模糊特征相关的用户“惊讶”的可能性,并允许对输入错误检测和报告进行更多的范围和控制。
您可以从一行或多行中直接读取多个项目。例如:
read (5, *) a, b, c, d
将从一到多行读取四个值。