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 

Fortran familiarization

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



Joined: 08 Apr 2011
Posts: 155

PostPosted: Tue Jul 05, 2011 11:09 am    Post subject: Fortran familiarization Reply with quote

Hello,

Please can anyone tell me the meaning of this;

propty1 = propty(1:np)//'EXP'


Please note that propty and propty1 are of type character.

Does it mean that if propty is 'SOMETHING' then propty1 will be 'SOMETHINGEXP'??

Please help
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Tue Jul 05, 2011 12:58 pm    Post subject: Reply with quote

YES. But - why don't you test it?

Code:
      PROGRAM TEST

      character*120  propty,propty1

      propty  = 'hello_dolly'
      propty1 = propty(1:6)//'anne'
      print*,propty1

      end

Regards - Wilfried
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Tue Jul 05, 2011 1:00 pm    Post subject: Reply with quote

Yes, but only if np = 9. If np is less that 9, say 4, you will get 'SOMEEXP'.

I suspect that your fragment of code is taking a filename and adding an extension. It may well be a filename with a path and a driveletter as well. Just guessing, but is np calculated from

np=LEN_TRIM(PROPTY)

If PROPTY was a proper filename already with an extension, then you might have to knock off up to 3 characters to get rid of that. Another way would be to read back from the end of the character string until you came to the dot. FTN95 has SET_SUFFIX@ and SET_SUFFIX1@ library routines for doing this job with less things to think about.

The // concatenation operator is particularly useful for splicing in invisible characters, e.g. //CHAR(10)//

Eddie
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 -> General 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