Re: How to convert integers to characters?
- From: hermitian <iamwuxin@xxxxxxxxx>
- Date: Sat, 29 Sep 2007 00:56:58 -0700
I finally find out the problems!
I didn't specify the formats of the data!
Big mistake!
On Sep 29, 3:29 pm, hermitian <iamwu...@xxxxxxxxx> wrote:
Thank you for all your kindly help, especially Richard Maine!
Here I still have a problem that it seems the method you demonstrated
did NOT work perfectly!
Below is the code to convert a (a real variable) to b (a character)
and then print out the length of b.
! Fortran 90 code begins
program ex
implicit none
real::a=123.4
character(len=10)::b
write(b,*)a
write(*,"(A8,1X,I3)")b, len_trim(b)
end
! Fortran 90 code ends
I use Debian Linux for i386 and have two fortran compilers installed,
g95 and gfortran.
(1) Being compiled by g95, the output is:
123.4 6
(2) Being compiled by gfortran, the output is an runtime error:
At line 5 of file ex.f90
Fortran runtime error: End of record
The actually expected length of character variable b is 5, but neither
6 nor an error!
So, is there anyone can figure out and fix the problem?
Many thanks!
.
- References:
- How to convert integers to characters?
- From: hermitian
- Re: How to convert integers to characters?
- From: Terry Duell
- Re: How to convert integers to characters?
- From: hermitian
- Re: How to convert integers to characters?
- From: Richard Maine
- Re: How to convert integers to characters?
- From: hermitian
- How to convert integers to characters?
- Prev by Date: Re: How to convert integers to characters?
- Next by Date: Re: Printing of Program Name ??
- Previous by thread: Re: How to convert integers to characters?
- Next by thread: Re: How to convert integers to characters?
- Index(es):
Relevant Pages
|