Skip to content

Redirect console output to string #42

Answered by jhmgoossens
SashmanGH asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,
Sonnet is a .NET (Framework) library, but the actual solving is done in the coin-or libraries like Cbc etc. in SonnetWrapper.
Sonnet itself outputs to the regular System.Console of .NET.
However, the underlying coin-or C++ libraries like Cbc use (s)printf etc. via message handlers to output, e.g. in CbcSolver.cpp. This output from (s)printf is not going to System.Console by itself.

Sonnet tries to hand a wrapped MessageHandler to the underlying coin-or C++ libraries, for example when reading Mps files to get the underlying message over to System.Console, but this isn't working for much of the CbcSolver output, which is why your Console.SetOut isn't capturing it, unfortunately. I haven…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@SashmanGH
Comment options

Answer selected by SashmanGH
Comment options

You must be logged in to vote
1 reply
@SashmanGH
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants