User forums > Using Code::Blocks

Redirect std::cout

(1/3) > >>

LordCB:
Hello,

have anybody a suggestion for me how I redirect the std::cout to the IDE´s build log window???

TDragon:
The stdout and stderr streams from the compiler tools are already correctly handled in Code::Blocks. So do you mean from your own project? If so, why the build log?

The short answer is that Code::Blocks isn't designed for that usage scenario.

LordCB:
hmm ..

I have a gui app and would like see my variables how they changes during running my app.
I  don´t want an extra console for those outputs I would like see this in the IDE ....

I know that I am able to watch my variables in my debugging session, but I don´t want debugging...

TDragon:
Code::Blocks isn't designed for that usage scenario.

Translation:
You can't do that.

LordCB:
Could this be a good solution...

I redirect the std::cout with this approach

--- Code: --- streambuf *psbuf;
  ofstream filestr;
  filestr.open ("test.txt");

  psbuf = filestr.rdbuf();
  cout.rdbuf(psbuf);

  cout << "This is written to the file";

  filestr.close();


--- End code ---

and open the file in a tab in the IDE during the execution....or??

Navigation

[0] Message Index

[#] Next page

Go to full version