c++

What's wrong with C++ compared to other languages?

I'm a novice programmer and have recently found a job doing C++ development... I've noticed that a lot of people seem to REALLY hate C++, calling it outdated/stupid/inefficient/whatever.. Personally I haven't really noticed any bad traits, but then that may be because I haven't had experience in anything else and I'm not experienced enou...

C++ Overloading Operator < with an int parameter (comparing to a type that isn't guaranteed to be an int)

Hi, I want to overload operators < and > to allow the searching of an int value inside a BST (which ain't designed to store ints but rather words). For those who are wondering why is this overload being done on the first place please check http://stackoverflow.com/questions/384587/c-im-stuck-filling-this-bst-with-its-proper-values I n...

User Breakpoint from nowhere

Hi, I have some code in MS VC++ 6.0 that I am debugging. For some reason, at this certain point where I am trying to delete some dynamically allocated memory, it breaks and I get a pop up message box saying "User Breakpoint called from code at blah blah".. then the Disassembly window pops up and I see *memory address* int 3 The ...

How does C++ pick which overloaded function to call?

Say I have three classes: class X{}; class Y{}; class Both : public X, public Y {}; I mean to say I have two classes, and then a third class which extends both (multiple-inheritance). Now say I have a function defined in another class: void doIt(X *arg) { } void doIt(Y *arg) { } and I call this function with an instance of both: ...

Draw Order in OpenGL

I am rendering an OpenGL scene that include some bitmap text. It is my understanding the order I draw things in will determine which items are on top. However, my bitmap text, even though I draw it last, is not on top! For instance, I am drawing: 1) Background 2) Buttons 3) Text All at the same z depth. Buttons are above the backgr...

How do I setup a callback mechanism for RichEdit in win32

In win32, how do I setup a callback mechanism for RichEdit I have not created myself? PART 1 I'm reading from a textedit field in another application's GUI. This works just fine now, except after the first read I'd like to fetch only new or modified lines. In GTK+ or Qt I'd just install a callback on some signal the field edits when it...

Why would I want to learn to use C# instead of C/C++?

I enjoy using Microsoft Windows and I've used C in the past and now I'm starting to learning C++, but it's going to take me some time to get proficient with it. I expect to write some simple applications and DLLs, not any low level stuff like 3D games, Operating System features or drivers. However C/C++ can be hard work with which to get...

Get signatures of exported functions in a DLL

Is it possible to get an exported (C style?) function's signature (parameter count/types, return type) from a DLL? I can view the list of function names, addresses, ordinals, etc. with DLL Export Viewer but I can't view the signatures. I only have the dll file and don't have neither .h nor .def files. UPDATE: Using a tool called API Mon...

C++ Mysql++, always fails connection!

Steps: - Installed Mysql Server 2005 - Downloaded Mysql++, built both debug and release version. - Ran install.hta and selected a directory - Added library/include directory in MSVC++ 2008 - Included mysql++.h in my application - Moved .dll files (libMYSQL.dll and mysqlpp.dll and mysqlpp_d.dll) to Debug folder. Relevant code: #include...

operator ThisClass() causing stack overflow

I want to keep the class simple and not defined a constructor so i can do Pt data = {0, 5}; so i figured the best way convert Pt_t from a short to long or vice versa is to do something like this. template <class T> struct Pt_t { T x, y; template <class T2> operator Pt_t<T2>() { Pt_t pt = {x, y}; return pt; } }; The compiler do...

How to fix memory access error

Hi, I am working on a migration project, here we are migrating large set of C++ libraries from Mainframe to Solaris. We have complted migration sucessfully, but while running the application, some places it crashes with 'signal SEGV (no mapping at the fault address)'. Since the application supports on windows also, we checked with pur...

C++ Abstract class - constructor issues

Socket has a constructor that takes a winsock SOCKET as parameter and stores it in a private variable: Socket::Socket(SOCKET s) { this->s = s; } I'm trying to make an abstract class "GameSocket" that will parse data from my Socket class: class GameSocket : public Socket { protected: void ParseData(unsigned char* data, int s...

DirectShow - How to overlay video with text

Hi, I am writing an application for Windows Mobile where I want to display some text over the video preview on the screen. Does anyone know how this could be done or if there's any good tutorial about it? Thanks! ...

Boolean operations on rectangle polygons.

Avast there fellow programmers! I have the following problem: I have two rectangles overlapping like shown on the picture below. I want to figure out the polygon consisting of point ABCDEF. Alternate christmas description: The red cookie cutter is cutting away a bit of the black cookie. I want to calculate the black cookie. Each r...

Need a c++ compiler to work with libraries (boost, ...)

Currently I`m using Visual Studio for writing code in C++. But it seems so weighty that I decided to switch for another one, preferably free, not so strict to system resources (I mean memory, of course) as VS to learn libraries, such as Boost and Qt. What compiler do you suggest? ...

How do I delete a file from a c++ app without console window in Windows?

I need do delete a temporary file from my c++ windows application (developed in Borland C++ Builder). Currently I use a simple: system("del tempfile.tmp"); This causes a console window to flash in front of my app and it doesn't look very professional. How do I do this without the console window? ...

create XmlSerializer in MFC C++

Hi, I want to implement in my MFC application project this logic, which written in C# looks like: XmlSerializer ser = new XmlSerializer(typeof(A_CLASS)); StringBuilder sb = new StringBuilder(); XmlWriterSettings sett = new XmlWriterSettings(); sett.Indent = true; sett.IndentChars = "\t"; using (XmlWriter sw = XmlWriter.Create(sb,...

Hand Coded GUI Versus Qt Designer GUI

I'm spending these holidays learning to write Qt applications. I was reading about Qt Designer just a few hours ago, which made me wonder : what do people writing real world applications in Qt use to design their GUIs? In fact, how do people design GUIs in general? I, for one, found that writing the code by hand was conceptually simpler...

C++ - gsoap : Parameter passing memory management issues

I am writing a web server and client test stub for it. I have questions regarding memory management of the parameters. From my client I am calling a soap function ns1_func1(input * pInput, output* pOutput) Now both input and output class contain pointers to other structs. For e.g class Output { class abc * p1; class def * p2;...

Cannot compile FSM sample code

There is a nice state machine tutorial called UML Tutorial: Finite State Machines by Robert C. Martin. But I can't compile the sample code it provides. I got *FsmTest.cpp(46) : error C2664: 'SetState' : cannot convert parameter 1 from 'class UnlockedState *' to 'class TurnstileState ' Please, help. Thanks. class Turnstile { public: vi...