Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

number to string in FORTRAN 2

Status
Not open for further replies.

syangusa

Computer
Nov 21, 2002
1
How to convert number to string in FORTRAN and vice versa? Thanks.
 
Replies continue below

Recommended for you

! To convert a number ( in a variable ) to a string character.
! Write the variable into the string character just as you would write it to an
! external disk file. Character strings are considered to be "internal files" in fortran.

Integer x
Character(50) xstring
x = 12345
Write( xstring, '(i10)' ) x
End

! To convert a character string ( of numeric digits ) to a numeric variable
! Read the value from the character variable ( "internal file" ) and assign its value to ! your numeric variable just as you would if you were reading a value from an external !disk file.

Integer x
Character(50) xstring
xstring = '12345'
Read( xstring, '(i10)' ) x
End

Dan :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor