Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

Internal read of real array to a string.

pecan204
Beginner
565 Views
Can I do an internal read writing real array values to a string like below?

Or is there an intrinsic function for this?

character*80 aatemp

Read(( xread1(k), k=1,nv(1) ),'(a)') aatemp
Write(lin2,*) aatemp

Thanks for any advice.

Ken
0 Kudos
4 Replies
Steven_L_Intel1
Employee
565 Views
You want an internal write.

Steve
0 Kudos
pecan204
Beginner
565 Views
Steve,

I rewrote and tried but do not see value when viewing aatemp with the debugger.There is a value is the array.

character*80 aatemp
Write( xread1(1),'(a)') aatemp
Write(lin2,*) aatemp

I assumed the full array would look like below.

Write(( xread1(1), k=1,nv(1) ),'(a)') aatemp
Write(lin2,*) aatemp

Do you see anything wrong?

Thanks
Ken
0 Kudos
Steven_L_Intel1
Employee
565 Views
Think of the character variable as a file. What you want is something like this:

write (aatemp, '(5F10.2)') (xread(k),k=1,nv(1))

Be aware that if you get to the end of the format and still have more elements, it will try to go to the "next record". In internal I/O, that means the next element of an array. Since aatemp is not an array, it will fail.

I suggest reading the Language Reference Manual section on internal write.

Steve
0 Kudos
pecan204
Beginner
565 Views
Thanks
0 Kudos
Reply