c++

Source Clean-up Question

I have source that has been around for 10 years old in C++. It works on OS X, Linux and Windows well. It is a static Library of API calls other developers might need to use. Over time, previous programmers have sort of not kept it tidy. So my question: There are several headers that most sources use. I could put them all in a single h...

Extracting GPU information using C++ (and hopefully WMI?)

Hi everyone! I'd like to know how to extract GPU using C++. However, the information that I'm interested in is not the data that is available from the Win32_VideoController class (ahh.. the Murphy's Laws of Programming). Specifically, I'm interested in the (Memory and Shader clocks). I'd like to know how to get at that information. I'...

Is it possibile to use TDD with image processing algorithms?

Recently, I have worked in a project were TDD (Test Driven Development) was used. The project was a web application developed in Java and, although unit-testing web applications may not be trivial, it was possible using mocking (we have used the Mockito framework). Now I will start a project where I will use C++ to work with image proce...

C string comparison problem in c++

I've been having trouble with comparison in my c++ program. This is the boiled down version. #include "stdafx.h" #include <iostream> #include <windows.h> using namespace std; int main(int argc, char *argv[]) { if(argc>2){cout<<"3+Args"<<endl;}else//??? if(argc==2){ cout<<"2args"<<endl; if(argv[1]=="/hide-icons"){} if(argv[1]=="/...

Lightweight C++ Gui Library

Hello everyone! I want to create GUI applications with C++ on Windows. I have downloaded Qt, and it works well, but it has sooooo much stuff in it and so many header files that I really don't use. It is a nice framework, but it has more than just GUI. Are there any lighter gui libs out there for Windows C++ that is "just gui"? Thanks...

C++ string addition

Simple question: If I have a string and I want to add to it head and tail strings (one in the beginning and the other at the end), what would be the best way to do it? Something like this: std::string tmpstr("some string here"); std::string head("head"); std::string tail("tail"); tmpstr = head + tmpstr + tail; Is there any better way ...

Algorithm for copying N bits at arbitrary position from one int to another

An interesting problem I've been pondering the past few days is how to copy one integer's bits into another integer at a given position in the destination integer. So, for example, given the destination integer 0xdeadbeef and the source integer 0xabcd, the idea would be to get a result of 0xabcdbeef (given a destination position of 16 bi...

What do i need to know about dynamic programming?

Started up solving UVa problems again as a way to pass time (going to the army in 6 weeks). I love writing Java, but end up using C / C++. It's not because IO is faster, no need to box data, more memory or use of unsigned, because its algorithm efficiency that counts. In short i am slowly constructing how to/article/code base for differ...

User Input of Integers - Error Handling

I'm having some trouble with certain input areas of my program. There are a few parts where the user inputs a specific integer. Even if they enter the wrong one that's all fine and dandy, but I noticed if they enter anything not of integer type like 'm' then it will loop the error message repeatedly. I have a couple functions that have ...

Assignment Algorithm

Hi, I need to assign N entities (each with possible parents and possible children) to M computation nodes while satisfying the following optimization conditions: Children of an entity want to be assigned to the same computation node (to maximize data locality among siblings) The distribution of entities should be as even as possible (...

Deleting keys with subkeys

How I can delete in Windows c++ registry keys with subkeys? RegDeleteKey() doesn't work. ...

How to create DRM scheme to protect MP3 files with C++?

Any ideas how I can create a DRM scheme to protect MP3 files using C++ or perhaps some other language? ...

boost pointer container insert (ptr_list)

Hello everyone. For some reason, I cannot get ptr_list to insert elements. boost::ptr_list<int> somelist; int *someint = new int(123); int *someint2 = new int(456); somelist.push_back(someint); boost:: ptr_list<int>::iterator i = somelist.begin(); somelist.insert(i,someint2); Any help, please? ...

A template with variable number of types

Hi, I want to write a C++ template like this: template <class Type1, class Type2, class Type3,....> class MyClass { //... }; But, "the number of types" is variable. For example, a user can create an object with 3 types: MyClass<int, int, int> obj; or he can create an object with 5 types: MyClass<int, int, int, in...

Is there any C++ function that allows me to convert a tiff format to a raw image?

The raw image should be read the tiff tags number.. Thank you. ...

Callback in C++, template member?

Following code does NOT work, but it expresses well what I wish to do. There is a problem with the template struct container, which I think SHOULD work because it's size is known for any template argument. class callback { public: // constructs a callback to a method in the context of a given object template<class C> callback(...

How to get the path of default profile .pst file (PR_PST_PATH property)

Hello, I´m trying to develop a custom address book provider for outlook. Using MFCMAPI to browse the store I found that the PR_PST_PATH property for the .pst file of the outlook default profile is reachable through IProviderAdmin-Interface. So I tried the following piece of mapi-code: // Get ProfileAdmin LPPROFADMIN lpProfileAdmin = ...

wxWidgets - Alpha blending

Is there a way in wxWidget to do alpha blending operations such as multiplying the alpha of a bitmap versus the RGB of other bitmap to generate new images (such as rendering a photo as an anti-aliased circular shape). ...

Callback in C++, template member? (2)

The following callback class is a generic wrapper to "callable things". I really like its API, which has no templates and is very clean, but under the hood there is some dynamic allocation which I was not able to avoid. Is there any way to get rid of the new and delete in the code below while maintaining the semantics and API of the cal...

Array values changed automatically to 0.

Today I had a strange encounter with gcc. consider the following code: float len[ELEM+1]; len[1]=1.0; len[2]=2.0; len[3]=3.0; //length nod[1][1] = 1; nod[1][2] = 2; nod[2][1] = 2; nod[2][2] = 3; nod[3][1] = 3; nod[3][2] = 4; //CONNECTIVITY for(i=1;i<nnod;i++) for(j=1;j<nfree;j++) /* bl...