- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
$Units,
SI,
$Independent variable,
0,10000
$Dependent variable,
5,5
When running the Compaq compiler, two backspace calls are required to move back/up a single line whereas only a single backspace call is required to move back one line in Intel Fortran. I'd prefer not edit the old code, so the real question is: Is there an Intel Fortran option I'm missing that would make my Intel fortran compiler backspace command work in the same way as the Compaq compiler backspace command?
OS: Windows 7 64 bit
CVF 6.1.0
Intel: 12.1.3526.2010 with VS2010
File Open call: open (CurvFileID,file=CurveName,iostat=ierr,mode='read',status='old')
Thanks for any help!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did your CVF project have the "/vms" option set?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[fortran] character*200 CurveName character*200 longline character*2 units integer length, i, nx real*8, allocatable :: CurveData(:,:) parameter (CurvFileID = 100) !c open curve file CurveName = "C:DATA.csv" open (CurvFileID,file=CurveName,iostat=ierr,mode='read',status='old') !c check if there are 6 lines in the curve data file do i = 1, 6 read (CurvFileID,*,iostat=ierr) end do rewind(CurvFileID) !Rewind back to beginning !c read unit read (CurvFileID,*) !read $units read (CurvFileID,*) units !read SI !c read independent variable read (CurvFileID,*) !read $Independent variable, nx = 1 !Find number of ,'s do while (.true.) read (CurvFileID,200,advance='no',iostat=ierr) longline !read 0,1000 length = len_trim (longline) do i = 1, length if (longline(i:i) == ',') nx = nx + 1 end do end do !c back to independent variable data line backspace(CurvFileID) backspace(CurvFileID) allocate(CurveData(nx,2),stat=ierr) !This reads "0,10000" in Compaq but reads "$Independent variable" in Intel read (CurvFileID,*,iostat=ierr) (CurveData(i,1),i=1,nx) !c read dependent variable read (CurvFileID,*) read (CurvFileID,*,iostat=ierr) (CurveData(i,2),i=1,nx) !c end reading curve file close (CurvFileID) deallocate(CurveData) 200 format (A) end[/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But the result I get then doesn't match your description, so I think I need to ask you to post an edited version of the program that demonstrates the problem and prints things I can look at. Please also attach data.csv as a file - I don't trust that your pasting the content does the right thing.
I will comment that if you read to the end of the file, so that you get an EOF condition, you are positioned past the "endfile record", which may or may not be represented physically in the file. If you then do a BACKSPACE, you are positioned before the ENDFILE record, not before the last record. This is what the standard requires.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
David,
It appears to me that you managed to do a work-around for a past bug in CVF.
Now that it has been fixed, you want a compiler option to "Restore old bugs". Relying on compiler options for non-standard implementations is not portable, although portability is becoming old fashioned.
This is similar to the problem of wanting to be backward compatible to old compiler extensions which no longer are compatible with the latest Fortran standard.
I hope the answer is to fix the code !
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After the DO WHILE loop, the file is positioned "after the record just read", which is after the "0,10000", but that is still the "current record". The first backspace "causes the file ... to be positioned before the current record, if there is a current record, or before the preceding record if there is no current record." So the first backspace takes us to the beginning of the "0,10000" record. The second backspace takes us to the "$Independent variable," record.
I'm at a loss to understand what CVF did here, but it is definitely wrong.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page