forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

problem with SIZE specifier in non advancing input

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
JohnyBergmann



Joined: 21 Nov 2005
Posts: 5

PostPosted: Wed Dec 07, 2005 7:14 am    Post subject: problem with SIZE specifier in non advancing input Reply with quote

The following program does not correctly detect the number of characters transferred during the nonadvancing read
[pre]
program readlen_1
implicit none
integer length, ios
character(len=5):: c

open(10,file="test.txt")
write(10,"(A)") "1"
write(10,"(A)") "22"
write(10,"(A)") "333"
write(10,"(A)") "4444"
write(10,"(A)") "55555"
write(10,"(A)") "666666"
write(10,"(A)") "7777777"
write(10,"(A)") "88888888"
close(10)

open(10, file="test.txt")

ios = 0
do while(ios == 0 .or. ios == -2)
read(10,"(A)", advance="NO",size=length,iostat=ios) c
if (ios == -2) then
print *,"EOR :",c,":", len_trim(c), length
elseif(ios == 0) then
print *," :",c,":", len_trim(c), length
endif
enddo

end program readlen_1
[/pre]
The output should show "length" to be equal to len_trim but it is always zero except when 5 characters could be read
This is the expected outpu
[pre]
EOR :1 : 1 1
EOR :22 : 2 2
EOR :333 : 3 3
EOR :4444 : 4 4
:55555: 5 5
EOR : : 0 0
:66666: 5 5
EOR :6 : 1 1
:77777: 5 5
EOR :77 : 2 2
:88888: 5 5
EOR :888 : 3 3
[/pre]
and this is what I get with ftn95 readlen_1.f90 /lgo:
[pre]
EOR :1 : 1 0
EOR :22 : 2 0
EOR :333 : 3 0
EOR :4444 : 4 0
:55555: 5 5
EOR : : 0 0
:66666: 5 5
EOR :6 : 1 0
:77777: 5 5
EOR :77 : 2 0
:88888: 5 5
EOR :888 : 3 0
[/pre]

P.S. Just to say I'm not looking for this bugs on purpose. I'm porting a library of Fortran 77 code to Fortran 95 and trying to use a xml library (written in Fortran 95) with my Fortran programs. With both projects I'm currently experiencing a certain number of issues, and some of them I can trace back to problems with FTN95


Johny
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7924
Location: Salford, UK

PostPosted: Thu Dec 08, 2005 1:53 am    Post subject: problem with SIZE specifier in non advancing input Reply with quote

Johny

Thanks for this. We will aim to investigate the problem as soon as we can.
Back to top
View user's profile Send private message AIM Address
Martin



Joined: 09 Sep 2004
Posts: 43

PostPosted: Sun May 07, 2006 4:16 pm    Post subject: problem with SIZE specifier in non advancing input Reply with quote

This problem has now been fixed ready for the next release of FTN95.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group