c++

C++ class - Increment and decrement attribute every N milliseconds

Hello all! This must be an easy question but I can't find a properly answer to it. I'm coding on VS-C++. I've a custom class 'Person' with attribute 'height'. I want to call class method Grow() that starts a timer that will increment 'height' attribute every 0.5 seconds. I'll have a StopGrow() that stops the timer and Shrink() that de...

Symbols (pdb) for native dll are not loaded due to post build step

I have a native release dll that is built with symbols. There is a post build step that modifies the dll. The post build step does some compression and probably appends some data. The pdb file is still valid however neither WinDbg nor Visual Studio 2008 will load the symbols for the dll after the post build step. What bits in either ...

unistd.h read() is reading more data then being written

I'm reading/writing data off of a named pipe. On the writing side it says that it's writing a constant 110 bytes. On the Reading side for the majority of time it says that it's reading 110 bytes which is correct, but other times it says its reading 220 bytes or 330 bytes. Which is right in the fact that when I print it out it's printing ...

Canonical form of += operator for classes

I know that it's a good idea to make as much of the interface of a class non-member non-friend as possible, and I've just realised that for my 3D vector class, 'Vector3', I can move the +=, -= and so on operators out of the class, leaving just constructors and the copy assignment operator. The question is: what should this operator look...

Is Qt Visual Studio add-in a subset of Qt Visual Studio integration?

Qt software recently released Qt Visual Studio Add-in. Does anybody know, is it a subset of Visual Studio Integration, or is there included something new? Anyone tried both? ...

Challenges in writing wrappers for C++ functions so that they can be used from C code

I am now writing wrappers for C++ functions, such that they can be used from C code. The idea is to compile the cpp files using g++ and the c files using gcc, then link them together (!), but exposing ONLY those functions that are needed, to the C programs, by making them available in a header file 'test.h' (or maybe test.hpp?), like so...

simple implementation of queue

I have the following queue class (taken from wordpress): #include<iostream.h> class Queue { private: int data; Queue*next; public: void Enque(int); int Deque(); }*head,*tail; void Queue::enque(int data) { Queue *temp; temp=new Queue; temp->data=data; temp->next=NULL; if(heads==NULL) heads=temp; else tail->next=temp; tail=tem...

How to convince employer to switch from Visual Studio 2005 to 2008?

I know that is good to switch to newer software, but what are the reasons which I can tell to people above me? In our department everyone has to code in the same IDE, so switching means for company buying approx. 10 upgrades and unless there is a good reason they are not very willing to do so (; We code in C++. ...

Is there any situation in which it would be useful or necessary to "double link" header files? (C++)

I use the term "double link" because I don't know what the actual phrase is, or if there is one, but assuming you have two headers, head1.h and head2.h, with these contents: In head1.h: #include"head2.h" //do stuff In head2.h: #include"head1.h" //do stuff I visualise it as two mirrors placed opposite each other, as it's not really...

Giving C++ Application a HTTP Web Server Functionality

I have a C++ app and looking for a library that would make it a HTTP Server that's able to serve static files as well as perform very simple tasks. The only constraint is that it must be Cross-platform. What are my options. Clarify: I need a web interface for my application. This application is a background program that does other ta...

How can I hook Windows functions in C/C++?

If I have a function foo() that windows has implemented in kernel32.dll and it always returns true, can I have my program: "bar.exe" hook/detour that Windows function and make it return false for all processes instead? So if my svchost, for example, calls foo(), it will return false instead of true. The same action should be expected fo...

disable folder virtualization in windows

I currently have a c++ application that gets built on xp and windows vista/7 virtualize some of the paths which i dont want it to do. Some sites says to add this to manifest file: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="...

c++ sort with structs

Hi, I am having a hard time with this problem which requires a sort of customer names, customer ids, and finally amount due. I have the whole program figured, but cannot figure out the last prototype needed to do the sorting. i have a struct called Customers, and i will provide the int main() part also. I just need any help to gt started...

Watching Global Events created by a native process in a .NET process.

I have a global event created and set/reset in a native C++ process that are created like this: HANDLE hGlobalEvent = CreateEvent(NULL, TRUE, FALSE, _T("Global\\MyEvent")); Is there any way (even if it's with a library not written by MS) to register for one of these events in a .NET (C#) process so that I standard .NET events handlers...

Object Registration in Static Library

I have implemented a very basic "plug-in system" as part of a static library. Each "plug-in" implements the support for a specific image format, e.g. GIF, JPEG, etc.. Furthermore, I have a Singleton (a class called PluginManager) that keeps a list of all available plug-ins. The tricky part is that I want to disable/enable the plug-ins b...

Why put a class declaration and definition in two separate files in C++?

I'm just wondering, what is the whole point of separating classes into an .h and a .cpp file? It makes it harder to edit, and if your class won't be compiled into a .lib or .dll for outside use, what's the point? Edit: The reason I'm asking is that the Boost libraries put everything in an .hpp file, (most of the libraries anyways), and ...

C++ string value as another strings name.

How can i convert a vartiables value int anothers name in C++? like in this php snippet. $string = 'testVar'; ${$string} = 'test'; echo $testVar; // test ...

Tiled movment

heres what Im working with now if (osl_keys->held.down) { sprite_position = DOWN; SpriteAnimate(); sceKernelDelayThread(20000); sprite->y += 16; SpriteAnimate(); sceKernelDelayThread(20000); sprite->y += 16; } if (osl_keys->held.up) { sprite_position = UP; SpriteAnimate(); sceKernelDelayThread(20000); sprite->y -= 16; SpriteAnimate(); s...

fail using hash_map<vector<int>,string>, why ?

I have implemented this code, but fail at compilation (VC2008 Express Ed.) : Now all code is here. #include <stdio.h> #include <vector> #include <string> #include <hash_map> using namespace std; using namespace stdext; typedef vector type_key; int main(int argc, char* argv[]) { type_key key; hash_map<type_key, string> map_s...

Fastest C/C++ image resizing library

I am writing a application that needs to resize massive amounts of images... and these are my requirements C/C++ Support jpeg/png at least Fast Cross-Platform So far my options are OpenCV CImg ImageMagick GraphicsMagick (say their fast) DevIL GIL from Boost CxImage Imlib2 (say their fast) Any others? All of these would get the j...