c++

C++ interview - testing potential candidates.

I have to interview some C++ candidates over the next few weeks and as the most senior programmer in the company I'm expected to try and figure out whether these people know what they are doing. So has anybody got any suggestions? Personally I hate being left in a room to fill out some C++ questions so I'd rather do a more complex test...

Directory structure for C++ library

I am working on a c++ library. Ultimately, I would like to make it publicly available for multiple platforms (linux/windows at least), along with some examples and python bindings. Work is progressing nicely, but at the moment the project is quite messy, built solely in and for VC++ and not multi platform at all. Therefore, I feel a cle...

QT 4.5 - QGraphicsItem is assigned to parent scene of 0x0

This is a rather strange situation here. I have a class which derived from QGraphicsScene class DrawingScene : public QGraphicsScene { ... } Whenever I add any item within the derived class, the item ended up attaching to a parent of 0x0. The thing is that despite that, the graphics item appearing within the scene as normal, and ca...

Query on Windows Filtering Platform

Dear All, I am using the Windows Filtering Platform API,to block some URL, I wanted to know is there any way to block all url and give exception to only few url. Please help me in this regard, give me ur thoughts on this with regards Vinayaka Karjigi ...

Can I rely on this to judge a square number in C++?

Can I rely on sqrt((float)a)*sqrt((float)a)==a or (int)sqrt((float)a)*(int)sqrt((float)a)==a to check whether a number is a perfect square? Why or why not? int a is the number to be judged. I'm using Visual Studio 2005. Edit: Thanks for all these rapid answers. I see that I can't rely on float type comparison. (If I wrote as a...

Can I use MiGLayout with C++?

I wonder if there is a C++ port if MiGLayout or if there is a way that I can use MiGLayout with C++. ...

Delphi PChar to C++ const char*

I am trying to use a C++ dll from a native program. I am following the virtual method scenario as explained here Lets say my C++ function signature is of the form int Setup(const char* szIp, const char* szPort); And the corresponding delphi signature is function Setup(ip, port: PChar):Integer: virtual; cdecl; abstract; And somewh...

Programmatically launch sfx archive on Windows 7 (using _execv)? (C++)

My (MS Windows) application can update itself over the internet by download a self extracting archive and launching it via _execv (C++). Now while launching the sfx archive works fine on Windows XP, it doesn't on Windows 7. I guess it has to do with UAC, but even turning UAC off didn't cure this problem. The downloaded sfx archive has th...

Service Control Security Issues in XPCOM

I'm am developing a Firefox extension which interfaces with an underlying Windows service (which I have already made). During the development so far I encountered one bug in the installer program (which installs the FF extension AND the service). This was due to the security model on Vista requiring elevated privileges to be able to ins...

Which one will be faster

Just calculating sum of two arrays with slight modification in code int main() { int a[10000]={0}; //initialize something int b[10000]={0}; //initialize something int sumA=0, sumB=0; for(int i=0; i<10000; i++) { sumA += a[i]; sumB += b[i]; } printf("%d %d",sumA,sumB); } OR int main() { ...

WNDPROC declaration problem, converting from C to C++

I am converting a program from C to C++. I have the compiler set to use the __fastcall calling convention by default. I used to have a declaration line as follows: INT32 PASCAL graph_window_handler(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) Later I have: wndclass.lpfnWndProc = graph_window_handler; This all compiled...

Making my GUI accessible through keyboard (Xp, Visual Studio, C++)

Hi guys, I've built a GUI with button, groups of buttons, edits, listboxes... etc... but now I want to know how to make my gui accessible through keyboard, I mean, changing the focus by pressing tab button. Does anybody have any idea on how to do this? I'm using Windows Xp and the GUI is writen on C++ using Visual Studio 2008. Thanks ...

C++ #define preprocessor

I need to know that does the #define directive in C++ declares global label? By global I mean visible in every file? I'm using Visual Studio 2008, (guess if that matters) ...

Difference between _declspec and __declspec?

I sometimes see keywords starting with two underscores and other times just one. Is there any difference? ...

Boost - cross compile - "from Linux" "to Windows"

Hello, I have downloaded "boost" (1.40.0) source code from their homepage "www.boost.org". I have Linux (Ubuntu 9.04 Jaunty) installed and trying to compile the boost libraries to the "WINDOWS" version (e.g. ".dll", NOT ".so") from my "LINUX" machine. And now an important question: IS IT POSSIBLE TO COMPILE TO THE "WINDOWS" BOOST LIBR...

Simplifying FOR loops

I have a function that essentially reads values in from a vector of doubles, appends these to a string (while ensuring a space between each and setting their precisions) and returns the end result, minus the final whitespace: std::string MultiplePrintProperties::GetHpitchString() { std::string str; vector< double >::iter...

Image warp with VTK?

Hi all, I'd like to warp a vtkImageData with a vector field, similar to what itk's WarpImageFilter does. the vtkGridTransform object seems promising, but there doesn't seem to be a vtkTransformImageFilter... Is what I want to do at all possible with VTK? Thanks a lot! ...

How should I choose where to store an object in C++?

Possible duplicate Proper stack and heap usage in C++? I'm beginning to learn C++ from a Java background, and one big difference is the fact that I'm no longer forced to: dynamically allocate memory for objects always use pointers to handle objects as is the case in Java. But I'm confused as to when I should be doing what -...

attaching char buffer to vector<char> in STL

What is the correct (and efficient) way of attaching the contents of C buffer (char *) to the end of std::vector? Thanks. ...

How to link graphviz with VIsual C++

Someone please tell me How to link graphviz( or call its code) in C++ (VIsual Studio) ...