c++

What is Boost missing?

After spending most of my waking time on Stack Overflow, for better or for worse, I've come to notice how 99% of the C++ questions are answered with "use boost::wealreadysolvedyourproblem", but there must definitely be a few areas Boost doesn't cover, but would be better if it did. So what features is Boost missing? I'll start by s...

Convert C++ Header Files To Python

I have a C++ header that contains #define statements, Enums and Structures. I have tried using the h2py.py script that is included with Python to no avail (except giving me the #defines converted). Any help would be greatly appreciated. ...

Porting Application from Solaris to Linux

Hi, I am to take up the task of porting a C++ networking application code base of quite a size from Solaris to Linux platform. The code also uses third party libraries like ACE. The application when written initially was not planned for a possible porting in future. I would like to get some advice and suggestions as to how I go about ...

getter setter wrappers for TiXmlElement*'s

Hi i am rewriting a project so that it uses getters and setters to reference the TiXmlElement *'s However i quickly run into problems that seem to be related to debug mode: ecxerpt from my class's header: TiXmlElement *_rootElement; TiXmlElement *_dialogsElement; TiXmlElement *_dialogElement; TiXmlDocument _document; void setDocu...

Being specialised and keeping up

One of the things mentioned recently maybe in the SO podcast or Joel was that the best way to succeed at business when you start out is to start specialised and concentrate on one thing only. If you say you're the jack of all trades; you're just another jack! If you say you're a specialist in - I think joels example was some type of fau...

Private/protected inheritance

In C++, I can't think of a case in which I would like to inherit private/protected from a base class: class Base; class Derived1 : private Base; class Derived2 : protected Base; Is it really useful? ...

Is there an open-source alternative to Windows compound files?

I'm trying to save a couple of files to a container file. The files can be modified later which means the container might have to be enlarged. The user should only see this container as a single file in the file system. The application is written in C++ and running on Windows, but the files should be portable to other platforms as well. ...

Returning Japanese characters via char* in an Excel XLOPER

I am retrieving Japanese characters from a data source and I want to return this data to Excel in an XLOPER. I am using a Japanese version of Excel 2003 (hence XLOPERs and not XLOPER12s). wchar_t* pszW = OLE2W(bstrResult); //I have the data I am trying to copy in a CComBSTR ULONG ulSize = ::WideCharToMultiByte( CP_THREAD_ACP, 0, pszW,...

VC++ 6.0 access violation when run in debugger

I am trying to add enhancements to a 4 year old VC++ 6.0 program. The debug build runs from the command line but not in the debugger: it crashes with an access violation inside printf(). If I skip the printf, then it crashes in malloc() (called from within fopen()) and I can't skip over that. This means I cannot run in the debugger and ...

Converting MBCS stream to UTF-8 and vice versa in C++

Hi, I'm using Visual C++ (VS2005) and compiling the project in Multibyte Character Set (MBCS). However, the program needs to communicate with a webapp (which is in utf-8) via XMLRPC. So I'm thinking maybe I can use MBCS internally and convert the strings to utf-8 before sending them to the xmlrpc module and converting them back to MBCS ...

(QT/kdelib) how to know the end of a command in KTerminalInterface?

I have a KTerminalInterface (from kparts) in my qt/kdelib app, and I run a command within it. The problem is: how can I know if the program is terminated? I need to know it because at its end I must reset some variable. Does anyone got a similar problem?!? ...

What is the origin of the term "baller" which means "pointer"?

I've seen the term "baller" used in a couple of C++ interview tests. It means "pointer" as best as I can tell from questions like "Describe the difference between a baller and a reference." I thought that perhaps it was an Indian term due to some Google deduction, but a couple of Indian co-workers who went to school in India said they've...

How to pass method result as parameter to base class constructor in C++?

I've trying to achieve something like this: class Base { public: Base(string S) { ... }; } class Derived: Base { public: int foo; string bar() { return stringof(foo); // actually, something more complex }; Derived(int f) : foo(f), Base(bar()) { }; } Now, this doesn't work as I want, because bar() is ca...

Finding the owner of an STL iterator

Is there any way that I can find the container pointed to by an iterator? Specifically, I want to be able to find the std::vector pointed to by a particular std::vector::iterator so that I can check the range, without having to actually pass references to that vector around. If (as I suspect) the answer is no, why not? edit: thanks fo...

Is requiring a certain order for #includes in c++ a sign of bad library/header design?

I've used some very large scale systems and never seen a required order, but came across it recently. Does the STL or STD library or even Boost have any cases where certain includes must come in a certain order? ...

Boost.format and wide characters

Is there a way to get boost.format to use and return wide (Unicode) character strings? I'd like to be able to do things like: wcout << boost::format(L"...") % ... and wstring s = boost::str(boost::format(L"...") % ...) Is this possible? ...

What can I use to profile C++ code in Linux?

I have a C++ application I'm in the process of optimizing. What tool can I use to pinpoint my slow code? :) ...

c++ allegro input

I'm building a simple ice sliding puzzle to test uses of allegro. So far I've got the whole thing working although I haven't actually added in the objective yet or the puzzle, just the engine behind it. I'm having a little trouble making "r" jump the player back to the starting spot, can anyone tell me why? #include <allegro.h> #include...

Changing the value of stdout in a C++ program

I have a Windows C++ program that is doing something like: FILE* pf = ...; *stdout = *pf; // stdout is defined in stdio.h I'm looking for an explanation about what happens when you change the value of the stdout file handle. Is this just a way of redirecting stdout? -cr ...

Is std::map + std::tr1::bind + standard algorithms worthwhile?

This is a follow-up to my question from yesterday. I have Scott Meyers' warning about write-only code on my mind. I like the idea in principle of using standard algorithms to access the keys or values of a std::map, but the syntax required is a little baroque IMHO. Let's say I want to dump all the keys of a map to a vector. Given fol...