c++

c++ program to watch directory for alterations

Hello! I am looking for a way to make a program in C or C++ that detects if there was any files altered, renamed, moved or deleted in a specified directory for Linux systems. Is there a way to do that? ...

[c++] Type erasure and accessors

Hi, I used type erasure pattern in C++, i.e I hide a template class with an abstract class class Base{ virtual ~Base(){} //pure virtual methods... }; template<typename T> class Derived : Base{ Derived<T>(){} ~Derived(){} //public methods... private : vector<T> datas; }; problem : if I want to retrieve or modify datas, I have...

Geometry -> OpenGL

Please help! =) I can't get the correct transformation in OpleGL. I have point3D - P(X,Y,Z), and projection matrix M, which equal to K*(R|T) where K - camera calibration matrix (R|T) - point (object) coordinate system transformation (R - rotation matrix, T - translation vector) As a result we have projected point as p = M*P I kno...

How to profile the memory consumption by a set of C++ classes?

I am trying to figure out the memory consumption by my (C++) program using gprof. The program does not have a gui, it is entirely cli based. Now, I am new to gprof, so I read a few tutorials, that taught me how to run gprof and spot time consumption. However, I need to find out the memory consumption by a specific set of classes. Say t...

Confused about testing an interface implementing method in C++.. how can I test this?

Please, consider the following (I'm sorry for the amount of code; but this is the minimal example I could think of...): class SomeDataThingy { }; struct IFileSystemProvider { virtual ~IFileSystemProvider() {} //OS pure virtual methods } struct DirectFileSystemProvider { //Simply redirects the pure virtuals from IFileSystem...

bi-directional communication using socketpair: hangs reading output from child process

I'm trying to use a socketpair to have a parent process provide input to a child process that execs a different program (e.g., grep) and then read the resulting output. The program hangs in the while loop that reads the output from the program that the child execs.. The child dupes stdin and stdout on to its end of the socketpair and the...

QT - Pointer to global memory

First: sorry for my English from Google The question: I'm changing the IDE, I'm migrating from Borland to QT with QT Creator. In Borland I used a class contained in a type library (APuma.dll). The prototype was:         BOOL XOpen (long hDIB, LPCTSTR FileName) / / OpenOCR - Cuneiform hDIB is a pointer to global memory of an image.This ve...

How to pass data from a QDialog?

In Qt, what is the most elegant way to pass data from a QDialog subclass to the component that started the dialog in the cases where you need to pass down something more complex than a boolean or an integer return code? I'm thinking emit a custom signal from the accept() slot but is there something else? ...

unsigned char* image to Python

hello All, I was able to generate python bindings for a camera library using SWIG and I am able to capture and save image using the library's inbuilt functions. I am trying to obtain data from the camera into Python Image Library format, the library provides functions to return camera data as unsigned char* . Does anyone know how to c...

Reading other's code...

Possible Duplicate: How do I begin reading source code? I've been studying C++ and Lisp for a while now.. Bur, everytime I try getting others code to read. WOW, it seems like I am very very lost. Anything has some tips? thank you, Mario ...

Unmanaged C++ Garbage Collection help

I'm a .net programmer, without much experience with unmanaged code. I've been adding modifications and additions to an unmanaged project, and everything is functioning just fine. Can you give me some pointers as to what kind of code/objects I need to be concerned about in regard to garbage collection? TIA ...

Functions defined in header / cpp file behaves different

File: A.h class A { public: struct x X; int show() { x.member_variable ? 0: -1; } }; Now if A.cpp is complied which includes A.h (which is actually in a huge project space) we see that x.member_variable value is not as expected. But if remove the show() method and place it in A.cpp the code behaves fine - meani...

Strange problem with the vector when calculating values to a member.

This is an updated follow-up from my last question: http://stackoverflow.com/questions/3494178/fatal-error-from-incrementing-loop I've finished the sorting algorithm, which seems to work fine. Now my problem is trying to calculate the health for each fighter(in the getHealth() function) based on levels in my vector to calculate correctly...

How to create overloading functions in Visual-C++ library (.net) ?

So what I want is to create 3 functions with same names but taking difrent arguments (one will take 2 and others one lats say System::String). (I will compile tham into .net library from visual-C++, create a c# project, connect my lib to it and want to be able to see in my library one function name which would have 3 overloads.) How to ...

Compile C++ code for AIX on Ubuntu?

Hi All, Question in one sentence: How can I compile code for AIX using G++ on Ubuntu? (Assuming it is possible) I hope that it is as simple as adding an option to the make file to specify target processor. I am a novice when it comes to most things compiler related. Thank you in advance. ...

How to understand the design and code flow of any product quickly?

I have switched to a new company and I am working on a product that has a huge code base without documentation. I want to quickly get acquainted with the design and the code flow of the product so that I may become a productive member ASAP Slowly and steadily one does gets to understand the code, but what should be the best and smart wa...

Template specialization: non-inline function definition issue.

The following code compiles properly. #include <string> template <typename T, typename U> class Container { private: T value1; U value2; public: Container(){} void doSomething(T val1, U val2); }; template<typename T, typename U> void Container<typename T, typename U>::doSomething(T val1, U val2) { ; // Some impleme...

unhandlex exceptions when using new after implementing a setup project in visual studio 2010

Hey I have my little client application which - when started - creates some user defined objects on the heap via "new" pHistory = new CHistory; This was no problem and everything ran fine until yesterday. I wanted to deploy my application and did decide to use a "Setup Project" from Visual Studio 2010. http://msdn.microsoft.com/en-u...

WS_CLIPCHILDREN does not work when in fullscreen.

Hello guys, I have a main window created with : if (!fullscreen) { wStyle = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_CLIPCHILDREN; wExStyle = WS_EX_TOPMOST; } else { wStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; wExStyle = WS_EX_TOPMOST; } I have also a child window created runtime w...

Fill multidimensional array elements with 0's

I have a 2d and i want to set the elements to zero without looping all the elements int a[100][200]; I can't initialize them at point of declaration. ...