mojomother
Programmer
In my code, I declare a large list of fixed-length character strings:
The ancient problem is that if I was to output such a string, it is always filled with spaces, no matter what its actual contents are:
When writing a single string, this is easily worked around by using TRIM:
However, I want to output the entire list, i.e.
In this case, TRIM can not so easily be applied since it doesn't work on an array. How can I output this string array with each individual string being written with its actual - rather than fixed - length?
Thank you very much for any help!
Matt
Code:
CHARACTER * 256 :: string_list(256)
The ancient problem is that if I was to output such a string, it is always filled with spaces, no matter what its actual contents are:
Code:
string_list(1) = 'test'
WRITE(*,'(A)') string_list(1)
OUTPUT: "test "
When writing a single string, this is easily worked around by using TRIM:
Code:
string_list(1) = 'test'
WRITE(*,'(A)') TRIM(string_list(1))
OUTPUT: "test"
However, I want to output the entire list, i.e.
Code:
WRITE(*,'(256A)') string_list
In this case, TRIM can not so easily be applied since it doesn't work on an array. How can I output this string array with each individual string being written with its actual - rather than fixed - length?
Thank you very much for any help!
Matt