Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Debugger perspective : How to show a variable content as it prints using << ?(Debugger perspective under Variables subwindow)
Debugger perspective : How to show a variable content as it prints using << ? [message #1818837] Mon, 30 December 2019 04:49 Go to next message
Eclipse UserFriend
Hi All,

I have been working with C/C++ CDT for a while now and I love it.

In Debugger Perspective, I just need to be able to see the custom class objects representations in the Variable subwindow as if they are printed in the console using the << operator.

Please let me know I could do that ....

Regards,
Re: Debugger perspective : How to show a variable content as it prints using << ? [message #1818885 is a reply to message #1818837] Tue, 31 December 2019 11:13 Go to previous messageGo to next message
Eclipse UserFriend
int TEST = 10;
cout << " TEST " << dec << TEST << endl;

Re: Debugger perspective : How to show a variable content as it prints using << ? [message #1818888 is a reply to message #1818885] Tue, 31 December 2019 12:56 Go to previous message
Eclipse UserFriend
You could write it to a string stream and view the buffer.
https://stackoverflow.com/questions/5193173/getting-cout-output-to-a-stdstring

Be aware that viewing the content of a string stream isn't easy.
You could do this instead:
#include <iostream>
#include <sstream>
using namespace std;

std::stringstream ss;
int main() {
	cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
	ss << 100 << ' ' << 200;
	std::string txt = ss.str();
	cout << txt << endl;
	return 0;
}

index.php/fa/37065/0/

You can also typecast and change the display base of variables by right-clcking on them in the Variables view.

[Updated on: Tue, 31 December 2019 13:52] by Moderator

Previous Topic:Writing in a File using a file descriptor
Next Topic:Archiving / duplicating / copying entire Project workspace?
Goto Forum:
  


Current Time: Mon Jun 16 06:46:20 EDT 2025

Powered by FUDForum. Page generated in 0.03758 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top