[mercury-users] Redirecting output to a string (stream)?
doug.auclair at logicaltypes.com
doug.auclair at logicaltypes.com
Wed Feb 15 15:06:18 AEDT 2006
Dear all,
Is there a way to redirect arbitrarily printed information headed for stdout to a stream that can be read in the same program? Something along the lines of
init_string_stream(Stream),
write(Stream, T),
make_readable_n_reset(Stream),
read(Stream, Term).
Specifically, I do not wish to write out to a file on the file system. I'm looking for something like a string_stream. Looking at std_util, io, and string, I didn't see anything like that. Is there one available? If not, what would it take to implement such a thing?
More directly: can the streams created from extras/stream/ be typed as io.output_stream and io.input_stream so that they work directly with io.write/4 and io.read/4? Is it possible to create a string_stream type that can have BOTH output_stream and input_stream roles as illustrated above?
Sincerely,
Doug Auclair
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list