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

Amateur question

fortran77
Beginner
645 Views
Hello ,
I want to convert a real variable into character.
Someone can help me please:mansad:
I tried this :

WRITE(REALVAR,*, IOSTAT=iErr)CHARVAR

but doesn't functionne.
PLEASE HELP!!
Thanks in advance.
0 Kudos
1 Reply
anthonyrichards
New Contributor III
645 Views

Try

REAL REALVAR

CHARACTER*100 CHARVAR

WRITE(CHARVAR,*, IOSTAT=iErr)REALVAR

Ensure that CHARVAR is long enough to take the contents of REALVAR. It is safer to use a definite format, like

WRITE(CHARVAR,'(E14.4)', IOSTAT=iErr)REALVAR

and ensure CHARVAR is longer than 14 characters.

0 Kudos
Reply