Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combine character, integer, character 1

Status
Not open for further replies.

hodgesse

Instructor
May 23, 2007
1
US
Hi all!

I have a situation:

char message(256),name(80)
integer myrank

I want to generate message such that I have a leading character string, a character version of myrank, and an ending character string of name.

I've tried all kinds of stuff with //, write(p1,'(I4')myrank, etc.

By the way, I'm at a conference and do not have access to my regular stuff. That's why I am asking.

This is in Fortran 77.
Hope I'm not causing trouble.

Thanks in advance for any help!

Sincerely,
me
 
It seems that your declaration is wrong, you got an array of characters in stead of a string

CHARACTER chararray(10)

is not the same as

CHARACTER charstring*10

(At least as far as I know, I'm not an expert either)

So you do

char message*256,name*80

And then

WRITE(*,*) name//'Extra text'//message

or so
 
Hi hodgesse

I would to it like this, if you want "a character version og myrank":

character message*256
character name*80
integer myrank,j,k
character str

j = len_trim(name)
k = len_trim(message)
write(str,'(i10)') myrank

write(*,'3(1x,a)') name(1:j),str,message(1:k)

Best wishes
GulliPe
 
...ahhhhhh

character str*10 (or character*10 str)

of course (not just "chatacter str")

GulliPe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top