I have some legacy Fortran code for which I’m writing a wrapper routine. The code allows to pass a unit number to which error messages will be written.
In the wrapper routine I need to capture these error messages in order to take appropriate action. If 0 is passed as unit number the code will write the error messages to screen (the unit number is changed from 0 to 6). This means I can’t use stderr (unit no 0) to capture the error messages.
So I’m looking for a way to redirect the I/O of a unit number to a variable or internal file. Is this possible?