c++

How do I print to the debug output window in a Win32 app?

I've got a win32 project that I've loaded into Visual Studio 2005. I'd like to be able to print things to the Visual Studio output window, but I can't for the life of me work out how. I've tried 'printf' and 'cout <<' but my messages stay stubbornly unprinted. Is there some sort of special way to print to the Visual Studio output window...

Need a Math Editor to write math formulas

Need a Math Editor to integrate to my application written on C# to be able to write math formulas. Can someone help me with this please? Some open source code will be great! Tell me steps, that integrate your suggested application to my application. ...

MFC: How to Identfy if Dialog was created using CPropertySheet or CTabCtrl

In reference to this question:Which is prefered CTabCtrl vs CPropertySheet I have a DDK that uses MFC which I am new to. The basic example from the DDK implements a simple dialog box with 3 tabs with the "Ok" and "Cancel" button on the right side of the box. Based on the question from the link above, seems like only CTabCtrl can have...

How to get tooltip text for a given HWND?

I'm looking for a way to get the tooltip control (if any) which is associated with a given HWND. The text of the tooltip control would be sufficient, too. The closest thing I found is the TTM_GETTEXT message, but it's meant to be sent to the tooltip control itself instead of the tool it's associated with. I don't have a handle to the too...

How do i create a new folder and save files to it?

Hello everyone, I am working off a project in visual studio 2008 and my program outputs a whole bunch of .txt files that i use to check if my program is running as it should. At first i was only outputting a few files, but now i'm outputting more and more and the input files and output files are getting mixed up and it is becomming har...

How to close dynamically created CDockablePane windows?

In my MFC (Feature Pack) application one can dynamically create docking panes to display charts/tables etc. However, I don't want to let the user open the same thing twice. I create a pane like this: // Create CMyDockablePane pPane pPane->Create(...); pPane->EnableDocking(CBRS_ALIGN_ANY); // Create CRect rcPane pPane->FloatPane(rcPane)...

How to generate a non-const method from a const method?

While striving for const-correctness, I often find myself writing code such as this class Bar; class Foo { public: const Bar* bar() const { /* code that gets a Bar somewhere */ } Bar* bar() { return const_cast< Bar* >( static_cast< const Foo* >(this)->bar()); } }; for lots of methods like bar(). Writing these non-con...

LP Simplex algorithm in C++

I need the robust C++ source code of the simplex algorithm (is a popular algorithm for numerical solution of the linear programming problem). Please, no links to wikipedia. I need good source code in C++, using templates, clear user-friendly names and work very well. Preferably algorithm must check the unstable floating-point calcula...

What Happens When Stack and Heap Collide

Hi, I am curious to know what happens when the stack and the heap collide. If anybody has encountered this, please could they explain the scenario. Thanks in advance. ...

Are const arrays declared within a function stored on the stack?

if this was declared within a function, would it be declared on the stack? (it being const is what makes me wonder) void someFunction() { const unsigned int actions[8] = { e1, e2, etc... }; } ...

Debugging Visual Studio builds from Eclipse

I'm just starting out on a cross-platform (Windows, Linux, OS X) C++ project, and we've decided to use Scons for our build system and Eclipse as our IDE. I've figured out how to trigger Scons to do a Visual C++ build from Eclipse, and for errors etc. to get reflected in Eclipse, so all good so far. However, what would be really nice is i...

How can I debug a program using scanf with ddd?

When ddd encounters a scanf statement, it displays "Waiting until GDB gets ready" message. The debugging activity stops here. Please guide me of overcoming this bug. I'm using an amd64 athlon processor. ...

Where to find a description of all the math functions like floorf and others?

math.h is not really a documentation. Is there something else that will describe these functions a but more in detail? ...

C++ vs C# for GUI programming

I am going to program a GUI under windows (will be about 10,000 line code with my estimates) and don't know C# or C++ (QT library) to choose for my needs. Please help me to choose. ...

Why don't iostream objects overload operator bool?

In this answer I talk about using a std::ifstream object's conversion to bool to test whether the stream is still in a good state. I looked in the Josuttis book for more information (p. 600 if you're interested), and it turns out that the iostream objects actually overload operator void*. It returns a null pointer when the stream is ba...

Debugging data in 'anynomous namespaces' (C++)

Recently, I got a crash dump file from a customer. I could track the problem down to a class that could contain incorrect data, but I only got a void-pointer to the class, not a real pointer (void-pointer came from a window-property, therefore it was a void-pointer). Unfortunately, the class to which I wanted to cast the pointer to, was...

Boost linking, Visual Studio & version control

I'm using Visual Studio 2008, and writing some stuff in C++. I'm using a Boost library (that is not header only). So, linking to Boost requires one to add the directory to Boost binaries to the project's "additional linker paths" setting. However, doesn't this conflict with source control? If I check in the project files, wouldn't the ...

c++, syntax for passing parameters

This code snippet is part of an isapi redirect filter written in managed c++ that will capture url requests with prefix "http://test/. Once the url is captured it will redirect those request to a test.aspx file i have at the root of my web app. I need some syntax help how to: 1) pass the "urlString" parameter to be displayed in my "te...

Using STL to bind multiple function arguments

In the past I've used the bind1st and bind2nd functions in order to do straight forward operations on STL containers. I now have a container of MyBase class pointers that are for simplicities sake the following: class X { public: std::string getName() const; }; I want to call the following static function using for_each and bin...

Using boost::bind with a constructor

I'm trying to create new objects and add them to a list of objects using boost::bind. For example. struct Stuff {int some_member;}; struct Object{ Object(int n); }; .... list<Stuff> a; list<Object> objs; .... transform(a.begin(),a.end(),back_inserter(objs), boost::bind(Object, boost::bind(&Stuff::some_member,_1) ) ); ...