Silverfrost Forums

Welcome to our forums

Fortran familiarization

5 Jul 2011 10:09 #8514

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

5 Jul 2011 11:58 #8515

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

      PROGRAM TEST

      character*120  propty,propty1

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

      end

Regards - Wilfried

5 Jul 2011 12:00 #8516

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

Please login to reply.