c++

How to use this virtual camera driver ?

If you download the vcam from http://tmhare.mvps.org/downloads/vcam.zip will see inside /Bin directory it's VCamD.ax and VCam.ax How are these files supposed to run? The link is from an answer from my previous question here ...

Is it safe to return local CStringW to the caller?

I have a function defined a local variable typed in CStringW, is it safe to return this object to the caller by value, not by reference? ...

C++ template partial specialization

I cant figure out how to specialize partially this template. compiler complains that template parameter N is not used in partial specialization #include <boost/multi_array.hpp> template<typename T, class A> struct adaptable; template<typename T, size_t N> struct adaptable<T, // line below is the problem ...

GCC Inline-assembly: call dword ptr

Hello. If I have the following code in Windows VC++: DWORD somevar = 0x12345678; _asm call dword ptr [somevar] How can I make the same thing in GCC inline-assembly, with AT&T syntax? __asm__ __volatile__ ( "call dword ptr [%%edx]" : : "d" (somevar) ); I've tried something like this, but it generates an "junk" error... And ...

c++ gdi animation not working

im trying to create ball animation using gdi but i can't get it working. i created a ball using this Graphics graphics(hdc); Pen pen(Color(255, 0, 0, 255)); graphics.DrawEllipse(&pen, sf , 0, 10, 10); i have while loop that loops and adds 1 to sf value basicly like this sf++; than i try to repaint the window(it doesn't work...

As a software developer what is your SNMP suite that easy to integrate into your software

Well, altough the S of the SNMP stands for Simple, yet, so far I haven't experienced it that way. And now that I am about to deploy my software on around around 180 remote Linux servers and wants to monitor the servers and configure my daemons all from a centralized point. I simply want you to recommend me the library which you'll confi...

C++ Forward declaration and pure virtual functions

Hi, I have a problem using forward declaration and virtual functions. I got the following error message during compilation. main.cpp:131: error: cannot allocate an object of abstract type ‘Database::MySQL’ database_mysql.h:31: note: because the following virtual functions are pure within ‘Database::MySQL’: database.h:28: note: vir...

Parameters assigment with default values for a function

Hi, I have thread spawning function which accepts many parameters which have default values in the declaration. int spawn( funcptr func, void *arg = 0,int grp_id = 1,const char*threadname); I want to initialize first parameter func and the last parameter thread name and remaining variables assigned their default values. spawn( myfunc...

free c++ compiler for mac not using xcode

Are there any free c++ compilers for macs that do not need xcode? ...

C++ template argument reference/value trait

I am not sure if title makes sense. let me explain what I want to do: I have template constructor, the argument generally must be reference, but can be value in certain cases. Ultimately, I would like to have something like: matrix_adapter(typename adaptable<T,A>::type); where adaptable<T,A>::type can either be value or reference de...

vector with constant size

I am looking for a C++ data type similar to std::vector but without the overhead related to dynamic resizing. The size of the container will remain constant over its lifetime. I considered using boost::array, however, that is not appropriate because it requires the size of the array to be known at compile time, which is not the case in m...

free c++ compiler for mac with open source license

Are there any free c++ compilers for macs whose license is open source? (basically one of these http://www.opensource.org/licenses/category) I don't have the DVD that came with my current OS, and it won't run the version of xcode I already have. ...

how to get median value from sorted map

I am using a std::map. Sometimes I will do an operation like: finding the median value of all items. e.g if I add 1 "s" 2 "sdf" 3 "sdfb" 4 "njw" 5 "loo" then the median is 3. Is there some solution without iterating over half the items in the map? ...

Message map macros

When do you use ON_COMMAND and when do we use ON_MESSAGE. What are the differences between them. ...

c++ QThread and boost call back functions

Hello, I would like to know whether there is any way to check the validity of a boost call back function. Issue is as follows class A; class B; In class A's initialise function following is done. boost::function < void(class B) > call_back; using namespace boost::lambda; call_back = bind(&A::callback_after_preparation, this, boos...

Can I write an interface for a template class in C++

I have an interface and a couple of implementations of a class that stores serialized objects. I'd like to make the implementation classes into template classes so I can use them with more than one type of object, but I'm getting compiler errors. #include <iostream> template<typename T> class Interface{ public: virtual void func...

"real time" update a Qt TextView

Hi, I have a Qt application with an embedded script/jit. Now I'd like to receive the output from the script on an QTextEdit (more specific QPlainTextEdit). For this purpose callbacks are being issued. The problem I'm facing is that whatever I try the output to the TextEdit is either delayed until the script has finished or gets stuck af...

Is std::swap atomic in C++0x due to rvalue references?

Since we have rvalue references in C++0x it seems to me that it should be possible to implement std::swap as an atomic operation with CAS. Is this the case in the new standard, and if not why? ...

How to find active QMainWindow instance ?

Greetings all, In my QT Application I have several QMainWindow instances. I keep track of opended QWindow objects in a Application Context object; At onepoint ,when a Menu item is clicked , I want to go through all this QWindows and check which Window is active and execute some operations. Please refer to following code snippet : //J...

MultiByteToWideChar API changes on Vista

Hello, I want an option to convert a string to wide string with two different behaviors: Ignore illegal characters Abort conversion if illegal character occurs: On Windows XP I could do this: bool ignore_illegal; // input DWORD flags = ignore_illegal ? 0 : MB_ERR_INVALID_CHARS; SetLastError(0); int res = MultiByteToWideChar(CP_U...