| New Reply |
Fortran: printing the Printing the Hex contents of a character variable |
Share Thread | Thread Tools |
| Mar30-12, 07:34 PM | #1 |
|
|
Fortran: printing the Printing the Hex contents of a character variable
Given a character variable
character*10 name write (6,111) name 111 format (?) what do I put in the format statement to print the hexadecimal contents of name? |
| Apr1-12, 08:15 AM | #2 |
|
|
Hhhmmm...I have never had such need. I don't think there is such a shortcut in Fortran as there is in C; so, I am afraid you are going to have to write your own little function to do so.
First, you will have to convert the character to decimal; you can use ichar(letter) for that. But then, you need your own little recursive function to produce hex. Here is a simple explanation of how to go about it for any decimal. |
| New Reply |
| Tags |
| character, format, fortran, hexadecimal |
| Thread Tools | |
Similar Threads for: Fortran: printing the Printing the Hex contents of a character variable
|
||||
| Thread | Forum | Replies | ||
| Fortran 77 reading from text file, printing | Engineering, Comp Sci, & Technology Homework | 2 | ||
| Question about printing with FORTRAN | Programming & Comp Sci | 1 | ||
| printing character arrays c++ | Engineering, Comp Sci, & Technology Homework | 8 | ||
| Get the contents of a file, character by character | Programming & Comp Sci | 7 | ||
| Printing certain values from a DO loop in Fortran | Computing & Technology | 3 | ||