Reputation: 41
In the Julia NMF package a verbose
option provides information on convergence using the @printf
macro.
How can I access this output without rewriting the NMF
package io?
To rephrase, having a function f()
containing the macro @printf
, how can I access the output outside f()
?
Upvotes: 4
Views: 106
Reputation: 7874
This does seem like useful functionality to have: I would suggest that you file an issue with the package.
However, as a quick hack, something like the following should work:
oldout = STDOUT
(rd,wr) = redirect_stdout()
start_reading(rd)
# call your function here
flush_cstdio()
redirect_stdout(oldout)
close(wr)
s = readall(rd)
close(rd)
s
Upvotes: 4