- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a simple 131 byte file that I am trying to read with fgetc using
ifort 10.1.008. Here is the code:
integer fgetc,ichar
integer i,j
character*1 ctmp
i=0
j=0
do while (j.ge.0)
j=fgetc(5,ctmp)
i=i+1
if(j.ge.0)then
write(6,'(i4,a,i4)')i,' ',ichar(ctmp)
else
write(6,*)'at EOF'
endif
end do
stop
end
This code reports only 130 bytes in the file. It is skipping the 41st byte which
happens to be an ascii code 13 (carriage return). There are however other identical
bytes elsewhere in the file. Both g77 and gfortran read the file correctly.
ifort 10.1.008. Here is the code:
integer fgetc,ichar
integer i,j
character*1 ctmp
i=0
j=0
do while (j.ge.0)
j=fgetc(5,ctmp)
i=i+1
if(j.ge.0)then
write(6,'(i4,a,i4)')i,' ',ichar(ctmp)
else
write(6,*)'at EOF'
endif
end do
stop
end
This code reports only 130 bytes in the file. It is skipping the 41st byte which
happens to be an ascii code 13 (carriage return). There are however other identical
bytes elsewhere in the file. Both g77 and gfortran read the file correctly.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please report this to Intel Premier Support.
![](/skins/images/DC0E2679F7049B943291D1ED082A478E/responsive_peak/images/icon_anonymous_message.png)
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