PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Redirect I/O to variable

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Maarten



Joined: 11 Aug 2007
Posts: 12

PostPosted: Wed Jul 18, 2012 10:47 am    Post subject: Redirect I/O to variable Reply with quote

Dear all,

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?

cheers,
Maarten
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5943
Location: The Portland Group Inc.

PostPosted: Wed Jul 18, 2012 1:24 pm    Post subject: Reply with quote

Quote:
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?
I don't think this is possible but maybe you could open a scratch file? When the unit is returned, rewind the file and then read back the messages.

- Mat
Back to top
View user's profile
Maarten



Joined: 11 Aug 2007
Posts: 12

PostPosted: Wed Jul 18, 2012 11:40 pm    Post subject: Reply with quote

mkcolg wrote:
I don't think this is possible but maybe you could open a scratch file? When the unit is returned, rewind the file and then read back the messages.


Yes I think that's the only solution then. Thanks.

cheers,
Maarten
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group