c++

What is process and thread?

Yes, I have read many materials related to operating system. And I am still reading. But it seems all of them are describing the process and thread in a "abstract" way, which makes a lot of high level elabration on their behavior and logic orgnization. I am wondering what are they physically? In my opinion, they are just some in-memory "...

How can I define a "Do-Nothing" sort?

Hi, I'm working on a system where I need to be able to sort a vector by a given predicate, which my classes shouldn't have control over. Basically, I pass them a derived class and they blindly sort on it. As one of the "delightful quirks", one of the sort patterns is order of entry. Here's what I've got so far. struct Strategy { vi...

Engine Matlab issues

Hello, I am triyng to implement Matlab in a c++ program. http://www.cl.cam.ac.uk/~sjeh3/wii/ The application is using gtk a wii mote lib and the Matlab Camera Calibration Toolbox (http://www.vision.caltech.edu/bouguetj/calib_doc/ ). it works perfectly. I want to use matlab ploting tools to build a graphic provided by the application. B...

Using C++ to Merge .reg files

Hey, I am simply trying to merge a .reg file into my registry using a very basic c++ program. The code is as follows: #include <iostream> #include <iomanip> #include <string> #include <fstream> #include <stdlib.h> #include <cstdlib> #include <stdio.h> #include <windows.h> using namespace std; int main() { string file = "regedit.e...

Tracking down the origin of a VS2k8 error message?

I have several maps containing a multitude of classes in my VC++ project, some of them default constructable, others not. When trying to build, I get a "no appropriate default constructor available" error. The problem is that the error is listed to occur in line 173 of map.cpp, which is the code for operator[]. It would seem that I'm acc...

Help with memory allocation for multiplayer game server

Hello, I'm kind of new to C++ development in linux and I'm trying to make a multiplayer game. I know that it is a bit of complex program to start but I have some background on this type of program from other languages so I guess the most difficult part is taming the language. Although I'm programming a multiplayer game, my doubts are ab...

Dependency difference between Release & Debug

I'm trying to write a rather simple ActiveX using c++ code. Problem is that Release binary has dependency at MFC90.DLL and MSVCR90.DLL which does not apear at the Debug. How to attack this?? ...

loading images only works when executable is open

[Edit] Note: These projects are projects that I have copied and renamed. Not sure if that would have anything to do with it. I am using the directx sdk and just playing around with it. I was trying to blit a image on to the screen by loading a external file. For some reason it does not work when I build it and run in debug. But If I go ...

UTF-8 Encoding error, need help converting text

I've been working on a statistical translation system for haiti (code.google.com/p/ccmts) that uses a C++ backend (http://www.statmt.org/moses/?n=Development.GetStarted) and Python drives the C++ engine/backend. I've passed a UTF-8 Python string into a C++ std::string, done some processing, gotten a result back into Python and here is t...

How can I determine the current exception in a catch (...) block?

Possible Duplicate: Determining exception type after the exception is caught? Following up on this question , I'd like to print out the current exception in a catch(...) block -- just for logging. One answer there says that there is no standard way of doing this, but I don't like taking no for an answer :-) current_exception...

Errors while compiling a test program using Qt

I am pretty new to C++/Qt I am following the book 'C++ GUI Programming with Qt 4' by Jasmin Blanchette and Mark Summerfield. I was working on an example program and got stuck up with some compilation errors which I was not able to resolve. Code and Errors below. Any help is appreciated. Thanks. finddialog.h #ifndef FINDDIALOG_H #defi...

Why is my DCOM client locking on a call to SendMessage?

Running on XP. I have a client that calls calls CoInitializeEx(NULL, COINIT_MULTITHREADED), loads a (local) DCOM object, and attaches an event interface so the DCOM object can send back events. The client looks a lot like notepad with a multi-line textbox covering the client area to display event messages. Here are the calls that create ...

return pointer to data declared in function

Hi! I know this won'T work because the variable x gets destroyed when the function returns: int* myFunction() { int x = 4; return &x; } so how do I correctly return a pointer to something I create within the function, and what do I have to take care with? How do I avoid memory leaks? I've also used malloc: int* myFunction2() { ...

Finding the spread of each cluster from Kmeans

Hello, I'm trying to detect how well an input vector fits a given cluster centre. I can find the best match quite easily (the centre with the minimum euclidean distance to the input vector is the best), however, I now need to work how good a match that is. To do this I need to find the spread (standard deviation?) of the vectors which ...

What are custom calling conventions?

Possible Duplicate: What are the different calling conventions in C/C++ and what do each mean? What are these? And how am I affected by these as a developer? ...

find if qtreewidgetitem is top level

Is there a way I can find out if the qtreewidgetitem I'm looking at is top level or not? I have a program crashing when I'm trying to take the text a parent if the item is top level(no parent). ...

Class design suggestions: extending a class and code reuse

The gist of this question is about extending a class, minimizing jam-packing everything into a single class, and maximizing code re-use. After reading this question, please feel free to edit the title or description to make it more succinct. Though the post looks long, I am just trying to be thorough by using a lot of examples. Suppose ...

Design Question: How can I maintain a stack of object

I have a struct call 'A', which has an attribute 'i', like this: typedef struct a { a() { i = 0;} int i; } A; And I would like to maintain a stack of A in my Main class: class Main { public: void save(); void doSomethingToModifyCurrentA(); void restore(); private: A currentA; stack<A> aStack...

Is there any non-GPL-opensource C\C++ H264 encoding library?

Could someone please point me to an opensource H264 encoding library (written with C/C++) that is not licensed under GPL? It is for not commercial app creation of cource. I just do not want to open its sources. ...

C++ vector problem

I have the following class declaration: class DEMData { private: int bitFldPos; int bytFldPos; const char* byteOrder; const char* desS; const char* engUnit; const char* oTag; const char* valType; int index; public: DEMData(); //DEMData(const DEMData &d); void SetIndex(int index); int GetIn...