c++

libxml for C++: How to add a root node to XML tree?

I have an xml file that looks like the following <siteinfo> ... </siteinfo> <page> <title>...</title> <revision> ... <revision> </page> It does not have a root/enclosing node so I get the "extra content at end of document" on running my program. After opening the file for parsing using libxml, is there a way to easily add ...

Design by Contract in C++?

Is that any library that aids in implementing design by contract principle in c++ application. EDIT: Looking for much better than ASSERT something like this ...

Marshalling a class intance's pointer between C++ and C#

I have an ActiveX control (written in C++) and reference it's RCW assemblies (created by aximp.exe) from a C# project. In the C++ code implementing the Ax control, I have a class implementing an interface which is exposed as a property of the Ax control. Looking at the generated RCW assemblies, I see the interface. And I can attempt t...

C++: best practices of dynamic vs. static memory in terms of cleanliness and speed

I have an array, called x, whose size is 6*sizeof(float). I'm aware that declaring: float x[6]; would allocate 6*sizeof(float) for x in the stack memory. However, if I do the following: float *x; // in class definition x = new float[6]; // in class constructor delete [] x; // in class destructor I would be allocating dynam...

how to catch the power button on wince ?

I would like to catch the power button flagged as VK_TPOWER in the documentation how is it possible ? ...

How to setup eclipse cpp to generate multiple executables

I have made a new project in a clean eclipse installation and imported a lot of source and header files into a source directory. Some of the source files are libraries, some have a main method and are supposed to be compiled into an executable. How can I indicate which source files are supposed to be executables? Should I make differen...

Shared libraries and .h files

I have some doubt about how do programs use shared library. When I build a shared library ( with -shared -fPIC switches) I make some functions available from an external program. Usually I do a dlopen() to load the library and then dlsym() to link the said functions to some function pointers. This approach does not involve including any...

Drawing on the Desktop Background (WIN32)

Is there any way to draw on the desktop background in WIN32 and also receive notifications when the desktop background is repainted? I tried this: desk = GetDesktopWindow(); dc = GetDC(desk); MoveToEx(dc,0,0,NULL); LineTo(dc,1680,1050); ReleaseDC(desk,dc); But it draws on the whole screen, even over windows that are on the screen. ...

custom FILE type in C/C++

Is it possible in C/C++ to create my own custom stream of type FILE (stdio.h) that can be used with fputs() for example ? ...

Segmentation fault during Transition of Control from C++ to Pro *C

Hi, I have written a small Pro *C/C++ application [ multi-threaded, daemon ] where, i used Pro *c to fetch some DB records and then call C++ function to generate XML files, which are sent through socket to third party. The problem is that, when the c++ function is called, it is generating the xml file properly, but ending up with Sig 1...

Automatically removing unneeded #include statements

Possible Duplicates: C/C++: Detecting superfluous #includes? How should I detect unnecessary #include files in a large C++ project? Hi, I've been following numerous discussions about how to reduce the build time for C/C++ projects. Usually, a good optimization is to get rid of #include statements by using forward declaration...

What would be the correct design approach?

Hi, I have following existing scenario. I have a Validator class containing validate( Command* ) function which validates the Command passed to it. class Validator { public: validate(Command* cmd) { // common validation logic } } I have three classes say WindowsExecute, SolarisExecute and AIXExecute. Member funct...

any code conversion tool for converting borland c++ to visual studio C++

I have a old windows application written in borland C++ 5.0. this uses the OWL library very much in it's code. this has to be ported to Visual studio 2005/2008 (C++ or C#). search in google shows lot of links but nothing quite concrete or useful. can anyone show the correct direction to start this? also share any pitfalls or best practic...

Active Directory Programming in C++ on Linux

Can anyone point me at good books for Active Directory Programming in C++ ( Linux ) or refer me to libaries for doing this? I need to authenticate application with is developed C++ and Sever has Active Directory , And before going to Start the application . I need to test user credentials information with Active Directory . ...

question on the use of libmemcached

Hello, This one could be a trivial 'yes or no' question but still could be helpfull. Could the C/C++ library libmemcached be used in a distributed file system ? I am asking this one because in all documentation on the net I came accross memcached was mostly assosciated with caching in web-service applications. An example : Let there be...

MSVC++ how to ouput something to the "output"-window during compilation

hello, sometimes i see that certain projects write something to the output during compilation. how can that be achieved in MSVC++ thanks! ...

Looking for a Basic Reverse Shell Example in C(++)

I'm trying to find a basic reverse shell example in C or C++, Basically I want to write a code to simulate the following netcat scenario: Listener: ------------------ C:\nc -L -p 80 Client -------------- C:\nc 127.0.0.1 80 -e cmd.exe For whom doesn't speak netcat: This means I want to redirect stdin and stdout from cmd.exe to netwo...

Best way to find a whitespace-delimited word in a CString

example: "select * from somewhere where x = 1" I want to find the whitespace-delimited "where", but not the "where" within "somewhere". In the example "where" is delimited by spaces, but it could be carriage returns, tabs etc. Note: I know regex would make it easy to do (the regex equivalent would be "\bwhere\b"), but I don't want to a...

How to pass the Directory path as command line for the process??

Hi iam using regasm.exe to generate tlb file and register the assembly programatically.But the path of tlb in .NET root directory itself. so do like this buffer contains c:\windows\Microsoft.Net\framework\v2.0.57\RegAsm.exe if(!CreateProcessW(buffer,L" C:\Program Files\Test\Test.dll /codebase /tlb /silent" ,NULL, NULL,FALSE, 0,NULL,...

Debug heap/STL debugging equivalent for GCC?

I plan on using GCC more (Linux and Windows) and I was wondering if there's an equivalent of the MSVC debug heap and the STL checks available for the GCC CRT and STL. I already know about tools such as Valgrind, but I'm looking for something built in the libraries. ...