- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
(Part one was a while back...)
I think formatted stream input is still rather sick with 12.1.1. Consider the following variant that goes from one character at a time to four characters at a time:
Even when you hit end of record, things still go awry...
formatted-stream-input.f90
test.txt
I think formatted stream input is still rather sick with 12.1.1. Consider the following variant that goes from one character at a time to four characters at a time:
[fortran]PROGRAM FormattedStream2
IMPLICIT NONE
INTEGER, PARAMETER :: unit = 10
CHARACTER(4) :: c
INTEGER :: stat
!****
OPEN( UNIT=unit, FILE='FormattedStream2.f90', ACTION='READ', &
FORM='FORMATTED', ACCESS='STREAM', STATUS='OLD', IOSTAT=stat )
IF (stat /= 0) STOP "Couldn't open the file :("
READ(unit, 100, IOSTAT=stat, ADVANCE='NO') c
IF (stat /= 0) STOP "Couldn't read the first four chars :("
WRITE (*, 100) 'The first four chars were "' // c // '" :)'
READ(unit, 100, IOSTAT=stat, ADVANCE='NO') c
IF (stat /= 0) STOP "Couldn't read the second four chars :("
WRITE (*, 100) 'The next four chars were "' // c // '" :)'
CLOSE(unit)
100 FORMAT(A)
END PROGRAM FormattedStream2
[/fortran] I get....[plain]>ifort /check:all /warn:all /standard-semantics FormattedStream2.f90 Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.1.1.258 Build 20111011 Copyright (C) 1985-2011 Intel Corporation. All rights reserved. Microsoft Incremental Linker Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. -out:FormattedStream2.exe -subsystem:console FormattedStream2.obj >FormattedStream2.exe The first four chars were "PROG" :) The next four chars were "ROGR" :)[/plain]which doesn't seem right to me.
Even when you hit end of record, things still go awry...
formatted-stream-input.f90
test.txt
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree - things are definitely awry. I will let the developers know. Issue ID is DPD200176211.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I expect the fix for this in Update 9.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page