I've been trying to convert integer data to strings without success. Silverfrost apparently doesn't have string handling functions, so I've been trying to use writing to an internal file as shown in the FORTRAN 95 manual. As an example, my write is as follows write(unit=str1,fmt='(A2)') Idat Is there another way to do this conversion?
string handling functions
The format for printing out 2-byte integers as decimal strings is I6, not A2.
Which string handling functions don't exist?
Thanks mecej4. The 'I' format worked.
Robert, string handling functions that directly do conversions between numeric and string (e.g., int to str and str to int) aren't available.
BK, that's a Whopper.
Where are such things available in Standard Fortran? What are the routine names where you used them before? You might be referring to MATLAB functions, and you can find a discussion here on how to get the equivalent in Fortran:
https://coderwall.com/p/dqwzea/str2num-and-num2str-functions-in-fortran
Or the routine SAYINT (see the manual https://www.silverfrost.com/manuals/77library.pdf )
Eddie
Quoted from BK .. string handling functions that directly do conversions between numeric and string (e.g., int to str and str to int) aren't available.
In Fortran strings processing is done differently than in C and its relatives.
In fact, Fortran has character variables of various fixed lengths (and, in very few compilers, kinds), and a small set of features for processing strings is built into the language. Such processing does not need to use functions such as atoi and itoa, as in C.