c++

Putting a C++ Vector as a Member in a Class that Uses a Memory Pool

Hey, I've been writing a multi-threaded DLL for database access using ADO/ODBC for use with a legacy application. I need to keep multiple database connections for each thread, so I've put the ADO objects for each connection in an object and thinking of keeping an array of them inside a custom threadInfo object. Obviously a vector would ...

Serialization with Qt

I am programming a GUI with Qt. In my GUI I have a huge std::map. And "MyType" is a class that has different kinds of filds. So, in a word, I want to serialize the std::map. How can I do that? Does Qt provides us with neccesary features? ...

Object does not exist after constructor?

Hello, I have a constructor that looks like this (in c++): Interpreter::Interpreter() { tempDat == new DataObject(); tempDat->clear(); } the constructor of dataObject does absolutely nothing, and clear does this: bool DataObject::clear() { //clear the object if (current_max_id > 0) { inde...

writing code for nm-alike command [C++]

Hi everyone! Out of curiosity about reverse engineering, I am thinking of writing a simple program (in C++) that takes an executable as input and produces the names of all the functions that were a part of source program of that executable. Any pointers on how should I go about it? Step-by-step approach would be much appreciated! EDI...

Regarding to get refrence of IDot11AdHocManager Interface of COM WiFi AdHoc manager Interface

I am Trying to create AdHoc connection and for this i am using AdHoc wifi Interface provided by Microsoft. I have written code :- IDot11AdHocManager *pIAdHocMng = NULL ; HRESULT hr = CoInitialize(NULL); hr = CoCreateInstance(CLSID_Dot11AdHocManager,NULL,CLSCTX_INPROC_HANDLER ,IID_IDot11AdHocManager ,(void**)pIAdHocMng); if(hr == ...

Create a overlay screen while a game/program is running?

Hello. Does anyone know how I can create a screen overlay while a program is running? Mainly while a game is running. If anyone has used xFire or Steam, these use this feature. I've created a winform which starts the game/program and then minimizes. Could the overlay be created in the same winform? Thanks for the help! :) ...

Shaped windows in gtkmm

How do I create shaped windows in Gtkmm. The shape must be defined using cairomm. ...

Does QThread::sleep() require the event loop to be running?

I have a simple client-server program written in Qt, where processes communicate using MPI. The basic design I'm trying to implement is the following: The first process (the "server") launches a GUI (derived from QMainWindow), which listens for messages from the clients (using repeat fire QTimers and asynchronous MPI receive calls), up...

Is it possible to tie a C++ output stream to another output stream?

Is it possible to tie a C++ output stream to another output stream? I'm asking because I've written an ISAPI extension in C++ and I've written ostreams around the WriteClient and ServerSupportFunction/HSE_REQ_SEND_RESPONSE_HEADER_EX functions - one ostream for the HTTP headers and one for the body of the HTTP response. I'd like to tie t...

Debug-only ostreams in C++?

I've implemented an ostream for debug output which sends ends up sending the debug info to OutputDebugString. A typical use of it looks like this (where debug is an ostream object): debug << "some error\n"; For release builds, what's the least painful and most performant way to not output these debug statements? ...

Transform OpenCV image data type to Devil image format and vice-verca

I want to use a CUDA-enabled SIFT library but I am using the OpenCV driver to get images from the webcam? The Cuda library is using the Devil Library for image data types. Should I transofrm the images from OpenCV data types to Devil? Or Should I use another method for getting images from the webcam[devil compatible data types]? Thanks f...

Initializing objects on the fly

I have a vector called players and a class called Player. And what I'm trying to do is to write: players.push_back(Player(name, Weapon(bullets))); So I want to be able to create players in a loop. But I see an error message says "no matching function for call Player::Player..." Then I've changed that to: Weapon w(bullets); Player p(...

Managing libraries and imports in a programming language

I've created an interpreter for a stupid programming language in C++ and the whole core structure is finished (Tokenizer, Parser, Interpreter including Symbol tables, core functions, etc.). Now I have a problem with creating and managing the function libraries for this interpreter (I'll explain what I mean with that later) So currentl...

c++ overloading delete, retrieve size

Hi, I am currently writing a small custom memory Allocator in c++, and want to use it together with operator overloading of new/delete. Anyways, my memory Allocator basicall checks if the requested memory is over a certain threshold, and if so uses malloc to allocate the requested memory chunk. Otherwise the memory will be provided by s...

C++, constructor restrictions

Hi everybaody, I'm studing C++ and I can't understand the meaning of the boldface sentence below: From IBM manual: The following restrictions apply to constructors and destructors: Constructors and destructors do not have return types nor can they return values. References and pointers cannot be used on constructors and de...

c++ opengl: glOrtho() - please explain the usage of this command

Hiya. I started learning OpenGL and I can't understand the usage of glOrtho. can someone please explain what is it used for ? thanks update is it used to set the range of x y and z coordinates limit ? glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); it means that the x, y and z range are from -1 to 1? thanks! ...

Emacs: annoying Flymake dialog box.

Hello, I have the following lines in my ~/.emacs.d/init.el (custom-set-variables '(flymake-allowed-file-name-masks (quote ( ("\\.cc\\'" flymake-simple-make-init) ("\\.cpp\\'" flymake-simple-make-init))))) (add-hook 'find-file-hook 'flymake-find-file-hook) When I open a C++ file that has a proper Makefile...

How to fix these compiler errors?

I have this source code from 2001 that I would like to compile. It gives this: $ make g++ -O99 -Wall -DLINUX -pedantic -c -o audio.o audio.cpp In file included from audio.cpp:7: audio.h:14: error: use of enum ‘mad_flow’ without previous declaration audio.h:15: error: use of enum ‘mad_flow’ without previous declaration audio.h:17: err...

Operators overloading for enums.

Is it possible to define operators for enums? For example I have enum Month in my class and I would like to be able to write ++my_month. Thanks P.S. In order to avoid overflowing I did something like this: void Date::add_month() { switch(my_month_) { case Dec: my_month_ = Jan; add_year(); break; ...

Copy method optimization in compilers

Hi All! I have the following code: void Stack::operator =(Stack &rhs) { //do the actual copying } Stack::Stack(Stack &rhs) //copy-constructor { top=NULL; //initialize this as an empty stack (which it is) *this=rhs; //invoke assignment operator } Stack& Stack::CopyStack() { return *this; //this statement will invoke co...