c++

Customizing STL iterator class

which concept in c++ teaches you to extend and write your own iterator class? I know a little about writing templates. ...

Null object in c++

hi, i am trying to check whether the ship object is null, but i got an error message Crane.cpp:18: error: could not convert ‘((Crane*)this)->Crane::ship.Ship::operator=(((const Ship&)(& Ship(0, std::basic_string, std::allocator >(((const char*)"arrive"), ((const std::allocator&)((const std::allocator*)(& std::allocator())))), std::ba...

How to auto-collapse certain comments in Visual Studio 2010?

A colleague of mine uses a abomination text editor that routinely leaves comment blocks all over the code. Needless to say, this is driving me rather mad. The comment blocks look like this: /* EasyCODE ) */ /* EasyCODE ( 0 WndProc */ /* EasyCODE F */ i.e. they all start with EasyCODE and most of them span several lines. Thankfully, V...

How to put an image and a QProgressBar inside a QTableView?

I'm developing some kind of download manager and display the file name, it's size and the remaining bytes in a QTableView. Now I want to visualize the progress with a QProgressBar and display an image (to indicate whether it's an down- or upload). How can I add or display a QProgressBar and an image inside the QTableView? ...

What's the principle of template in C++?

And which templating library should new beginner user? Not sure if OS matter,I'm talking about windows if that matters. ...

SAP ERP 4.0 Integration

Is there a SDK for C++ or .NET available for SAP ERP 4.0 as I need to read and write data into it. ...

C++ free encryption libraries

So far I've come across Botan and Crypto++ which both provide reversible (e.g AES) and non-reversible (e.g SHA) encryption. I wondered if anyone can recommend either, or something else? ...

Which C++ version has #include iostream.h already defined? "didn't have to use std::"

When I took my second programing class this was the version. (long time ago) My teacher let me take it home to practice it was on 5-7 disk (3.5 floppy) to install. I believe it's Turbo C++ Professional 2.0 It had templates, projects options and used the standard mini square blue screen (ide). You didn't have to use any extra includes or...

Array and Rvalue

$4.2/1 - "An lvalue or rvalue of type “array ofN T” or “array of unknown bound of T” can be converted to an rvalue of type “pointer to T.” The result is a pointer to the first element of the array." I am not sure how do we get an rvalue of an array type other than during initialization/declaration? ...

Reboot on installation of .CAB WM

On a windows mobile 6 or CE5 device, I need to install a CAB file then initiate a reboot. I am aware of custom actions, you need to create a setup.dll for the CAB file in native C++. So I have the following code already made codeINSTALL_EXIT Install_Exit(HWND hwndParent, LPCTSTR pszInstallDir, WORD cFailedDirs, WORD cFailedFiles, WORD...

Subtract images by using opencv

Hi, I want to subtract two images. My problem ist that the cvSub()-funtion saturates. What I want to do is: 1) Convert the original images to grayscale. 2) Take the grayscale-images (values from 0-255). 3) Subtract the images (values from -255 to 255) -> problem of rescaling using cvSub(). 4) Rescale by multiplying with 0.5 and addi...

Rebuild the binary tree from a file

The inforamtion below is given in a file, and You have to make a function to rebuild the binary tree in C++.. node leftchild rtchild 1 2 4 2 $ 5 5 6 7 6 $ $ 7 $ $ 4 $ 8 8 $ $ $- Empty Can anyone suggest some idea to rebuild the binary tree...??? I have done:- void rebuil...

Nonrecursive quicksort with stack

i am trying to implement quicksort with stack here is code #include <iostream> #include <cstdlib> using namespace std; template<class Item> class STACK{ private: Item *a;int n; public: STACK(int maxN){ a=new Item[maxN];n=0; } int empty()const { return n==0; } void push(Item item){ a[n++...

Convert built in types to vector<char>

My TcpClient class accepts vector<char> in its SendData method like this: void CTcpClient::SendData(const vector<char>& dataToTransmit) Therefore, in order to use the function, I have to convert any built in type (int, long, short, long long) to a vector<char>. I tried several solutions using streams but always end up with an ASCII...

deleting bytes from an ostringstream

Hi, how do i delete the first n bytes of an ostringstream? I basically have to see howmany bytes went over a socket and if it did not go through fully...i have to delete whatever went through ...

Weird compiler error and template inheritance

Could someone explain me why this code: class safe_bool_base { //13 protected: typedef void (safe_bool_base::*bool_type)() const; void this_type_does_not_support_comparisons() const {} //18 safe_bool_base() {} safe_bool_base(const safe_bool_base&) {} safe_bool_base& operator=(const safe_boo...

Threadsafe logging using streams

I have to implement a threadsafe logging mechanism in C++ under Windows and I want to use the streams library. I wanted to know if anyone could give me some advice regarding doing this and what would be the best way? The logging messages will most likely be a few lines long each time, so I'd probably need to write them to a buffer firs...

shared memory across compilers?

Hi, I have to start off by saying I have very little idea on this topic so humor me if i seem ignorant. Due to the problem of having to use a vc++ library in a g++ compiled program, I built a local server-client system where the server is compiled in vc++ and the client in g++ and they interact through sockets. A lot of data transfer o...

why is that IXSLTemplate::putref_stylesheet compile when passed an IXMLDOMDocument argument

hello I am playing with XSLT with MSXML2 for the first time. And of course it doesn't work :-) I have a bug which I cannot figure to solve. So as to fix the bug, I try to understand everything around: and something shocks me. void xsltProcessing(IXMLDOMDocument* pXmlDoc, IXMLDOMDocument * pXslDoc) { CComPtr<IXSLTemplate> pTemplate...

visual studio 2010 don't want open new project (application wizard open in internet browser)

My c++ visual 2010 don't want open new project, every time when I put name of the project and click OK button after that it open my internet browser instead of Win32 Application Wizard. For better demonstration i record my steps here : http://tinypic.com/player.php?v=iqxzk4&amp;s=7 ...