Please notice output (long) 0 in stdout. If i do m.Exec(); (with ‘;’ in the end)
root [1] m.Exec();
the (long) 0 output is hidden. But when i try to use it in my c++ application without root interpreter i see this output. Can you give me hint how to hide it or what am i doing wrong. Example for my code is something like this
Longptr_t ok = fMacro->Exec(TString::Format("(NdmSpc::PointRun*)%p", this));
This is exactly the intended behaviour. The ROOT repl will print to screen the result of executing the line if there is no ; character at the end, whereas filling the line with the ; token, which makes it a proper C++ line of code, will behave like standard C++.
I don’t understand this point, what do you mean exactly? The snippet you are showing afterwards does not show the output. Note that the return type is indeed correctly Longptr_t as you write.
I understand what you mean. From what I can see, TMacro runs the macro verbatim, including all the output from the macro which includes the return value. You can easily redirect this output for the scope where you are running the macro. There are many ways to do it also with standard C++ (see for example this SO question) and you can do it with the following ROOT helper class as well: