c++

XMLUnit for C++

Hi, Anyone knows if there exists something like XMLUnit for C++. I'm looking for an easy way to check nodes, values, etc in a XML output. We are using google test in Visual Studio but I suppose any library that makes the work easier will be enough... I'm using Xerces as a XML parser but XMLUnit (http://xmlunit.sourceforge.net/) has s...

Open a socket using CreateFile

We've got some old serial code which checks whether a serial port is available simply by opening it and then closing it. Now we are adding network support to the app I want to reuse the function by supplying the ip address as a string. /** * So far I have tried: * A passed in portPath normally looks like: \\?\acpi#pnp0501#1#1#{GUID} ...

Get depth buffer from QGLPixelBuffer

I'm using OpenGL in a QT application. At some point I'm rendering to a QGLPixelBuffer. I need to get the depth buffer of the image, what I'd normally accomplish with glReadPixels(..., GL_DEPTH_COMPONENT, ...); I tried making the QGLPixelBuffer current and then using glReadPixels() but all I get is a white image. Here's my code bufferCa...

Matrix implementation benchmarks, should I whip myself?

Hello. I'm trying to find out some matrix multiplication/inversion benchmarks online. My C++ implementation can currently invert a 100 x 100 matrix in 38 seconds, but compared to this benchmark I found, my implementation's performances really suck. I don't know if it's a super-optimized something or if really you can easily invert a 200 ...

Moving forward with a career: C++ or C#?

I'm not asking if C++ is better than C# or vice versa. But if given the option of moving into a new job that exclusively used C++ or one that exclusively used C# (or .NET in general), which would you choose? And I'm looking at this entirely from the view of being a Windows programmer either way. I ask because I currently use both lang...

the returned SDL_cursor from SDL_GetCursor() can't be used with SDL_GetMouseState()?

I'm trying to get the x, y, and state of my mouse in SDL. I tried using the lines int mstate, mx, my = 0; mstate, mx, my = SDL_GetCursor().SDL_GetMouseState(); But it gives me the error C:[path]\particletest2\main.cpp|107|error: request for member SDL_GetMouseState' in SDL_GetCursor()', which is of non-class type `SDL_Cursor*'| ...

C/C++ linker CALL16 reloc at xxxxx not against global symbol

I'm getting these errors while linking, both messages have to do with the same object file. CALL16 reloc at 0x5f8 not against global symbol and could not read symbols: Bad value The 2nd message seems to be the reason I'm getting the CALL16 error, but the file compiles just fine. Any tips on fixing this? FYI, I'm cross compiling f...

In c++ making a function that always runs when any other function of a class is called

C++ has so much stuff that I don't know. Is there any way to create a function within a class, that will always be called whenever any other function of that class is called? (like making the function attach itself to the first execution path of a function) I know this is tricky but I'm curious. ...

How do I use OLE-DB to access a dbf file in an COM/C++ ATL application?

I need to access the data contained in a dbf file in COM/C++ application (created via ATL). How would I do that? I've been reading tons of msdn articles very instructive about the OLE-DB provider-consumer model. However, what I need now is a quick tutorial or code sample. Note: I am by no means no expert in COM/ATL programming :) Than...

Is there a way to allow a Windows service (unmanaged c++) to write files on a shared network folder?

I tried running the service in the "Local System" : didn't work. I tried running the service in an account having rights on the network shared folder : didn't work. Do I have to create a standalone application for this and launch this application as a user with rights on the network shared folder? Thanks, Nic ...

Consequences of these Pointer Errors in C++ vs Managed

I'm making this a community wiki in order to better understand the semantic differences between these errors and their runtime or compiled consequences. Also, I've coded on Java far too long and I want to learn pointers better in C++ -- so I need other people to do it. Edit2: I am refactoring this question. The distinction I am trying...

C++ code to find all ip address in a file

Hi, I need to write a program to scan a text file and retrieve all ip addresses (of the format 256.256.256.256) in the file. Can you please help me out? ...

Why does this dynamic_cast of auto_ptr fail?

#include "iostream" class A { private: int a; public : A(): a(-1) {} int getA() { return a; } }; class A; class B : public A { private: int b; public: B() : b(-1) {} int getB() { return b; } ...

Making a method template - C++

Below code is used to get a std::string representation from ASCII code. string Helpers::GetStringFromASCII(const int asciiCode) const { return string(1,char(asciiCode)); } It works well. But in my application, I know the ASCII codes at compile time. So I will be calling it like string str = GetStringFromASCII(175) // I know 175...

C++ function that returns string doesn't work unless there's an endl involved...?

I've got a function inside of a class that returns a string. Inside this function, I can only get it to work when I add cout<<endl to the function before the return statement. Any idea why this is, or how I can fix it? I'm running this in Eclipse on a Mac In "main.cpp": #include <iostream> #include <fstream> #include <string> #includ...

How to force parent window to draw "under" children windows?

The environment is plain-old win32 under C/C++ without any fancy MFC or similar mumbo-jumbo. I have a window, which has several children and grandchildren. Some children are oddly-shaped icons, and I need them to have transparent background (oddly-shaped icons). Consider a this pseudo-structure: Parent1 Child1 (normal) Child2 (oddly-s...

What is the best Framework to use for developing a skinned application?

I need to develop an application for windows, and it needs to support skins. I am looking for a framework to use. I would much prefer to not use QT, because of it's licensing - GPL is not an option for me, and it is otherwise to expensive (and I can't put off developing this application till March, when QT is supposed to go LGPL). Doe...

Call a constructor on a already allocated memory

Hello everyone, here is a short question : Using C++, how can I call a constructor on a memory region that is already allocated ? ...

What is the "metadata operation failed" VS2008 linker error?

I have a big project that was first created in Borland C++ 6. We're porting the program gradually to VS2008. There are many projects, which all compile to .lib, and I'm trying to build the exe of the test project for a set of projects. After fixing the compiler errors, I got this crazy linker error: *1>av_geos_core_domain.lib(GerTamMo...

Good example of C++ application?

Hi, everyone. Where I can find some good example application written in C++? I want to read some code in my spare time, how can I get started? ...