{"title":"Stream input/output in Fortran","authors":"C. Page","doi":"10.1145/1105755.1105757","DOIUrl":null,"url":null,"abstract":"Traditionally, and indeed until the advent of Fortran2003, Standard Fortran I/O has been entirely record-based. This is fine if you are reading or writing a file of records such as a text file, where each line is a record, since it means that you don't need to be concerned about the record terminators (which, depending on the platform, may be line-feeds, or carriage-returns, or both). It can, however, be a serious handicap when you want to use Fortran to read a file generated by some instrument, or produced by a package such as a spreadsheet or database system. Often these files do not have records that Fortran can recognise, or they have a more complex structure than a simple linear sequence of records, but Standard Fortran has not previously provided any means of accessing them simply as a stream of bytes or characters. Another problem is that sometimes one wants to access the records in some random order, rather than in a strict sequence. One can do this in Fortran using direct-access files, but these are restricted to files where all records have the same length. Stream I/O provides solutions to all these problems.","PeriodicalId":379614,"journal":{"name":"ACM SIGPLAN Fortran Forum","volume":"43 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2005-12-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"ACM SIGPLAN Fortran Forum","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/1105755.1105757","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1
Abstract
Traditionally, and indeed until the advent of Fortran2003, Standard Fortran I/O has been entirely record-based. This is fine if you are reading or writing a file of records such as a text file, where each line is a record, since it means that you don't need to be concerned about the record terminators (which, depending on the platform, may be line-feeds, or carriage-returns, or both). It can, however, be a serious handicap when you want to use Fortran to read a file generated by some instrument, or produced by a package such as a spreadsheet or database system. Often these files do not have records that Fortran can recognise, or they have a more complex structure than a simple linear sequence of records, but Standard Fortran has not previously provided any means of accessing them simply as a stream of bytes or characters. Another problem is that sometimes one wants to access the records in some random order, rather than in a strict sequence. One can do this in Fortran using direct-access files, but these are restricted to files where all records have the same length. Stream I/O provides solutions to all these problems.