c++

Programming resources for C++ in Linux

Hi all. I am new (in a way) to C++ programming. I would like to start doing development in linux using C and/or C++ as programming language. I have done a development for a while in Java. Unfortunately, I am not sure where to start. Can you point me to some good resources and also give me a outline as to what would be the primary dif...

Which programming technique helps you most to avoid or resolve bugs before they come into production

I don't mean external tools. I think of architectural patterns, language constructs, habits. I am mostly interested in C++ ...

How do I create synchronization mechanisms in managed shared memory segments?

I'm trying to have 2 processes communicate via an stl container - so I've decided to use the managed shared memory. I'm trying to implement some synchronisation between them - an interprocess_mutex for a start with a scoped_lock - but I'm not having much luck. How is it supposed to be done? ...

How to use Winsock 2?

How do I use Windows Sockets 2 in Visual Studio 2008. I'm using precompiled headers, so far what I have tried is: Included winsock2.h in my StdAfx.h file and entered WS2_32.LIB as an additional dependency in Project Settings I get these errors ------ Build started: Project: TestIVR, Configuration: Debug Win32 ------ Compiling... mai...

Learning C++ Example Problems

I am currently going though the process of learning C++ though reading programming books. I understand the concept but find a few days after reading, the concepts start to drift from my memory. The only thing that keeps them there is working through examples/questions. Are there any good sites or books that can be recommend which give ...

The Boost Statechart Library - how to implement time-consuming transitions

In our project we have UI and logic (which may be represented as a state machine). Transitions between some steps in this step machine are long (IO-bound). We don't want to steal our UI thread for all the time the transition is in progress. Therefore we are looking for a way to perform this transitions in a separate thread and then updat...

How to decompile a DLL in C++

I have an old DLL that stopped working (log2vis.dll) and I want to look inside it to see what objects it uses. The DLL was written in C++ (not .NET). Is there a tool that will decompile/disassemble C++ files? ...

Is switch from MFC to QT or WTL (or other GUI toolkit) recommended for Windows CE development?

There are pretty many questions regarding C++ GUI toolkits for Windows, but they mostly apply to desktop OS versions. I'm now starting a C++ project for Windows CE 5.0 VGA hand-held device, and thinking about what GUI library to choose. I have some experience using MFC in Windows CE projects, but there are some known weak points of MFC ...

How do I check if a process is running from c++ code ?

Hey all, I'm writing a C++ app that will communicate with another process via boost::interprocess, however I need to check if the other process is actually running first - as the other process is responsible for creating the inter-process shared memory. How do I check if the other process is running ? folks, I'm specifically required t...

is there such list control in c++

I am using MFC. I need a control just like listControl, it has such functions: MyListControl mylistControl = new MyListControl(); mylistControl.setDataSource(...); mylistControl.setSQLStatement("select a, b, c, d from table where a > 3"); and system will have a listControl which is populated with the data from database, and generate t...

Using stl containers without boost pointers

My company are currently not won over by the Boost libraries and while I've used them and have been getting them pushed through for some work, some projects due to their nature will not be allowed to use Boost. Basically libraries, like Boost, cannot be brought in for work so I am limited to the libraries available by default (Currently ...

Getting user temporary folder path

How I can get the user's temp folder path in C++? My program has to run on Windows Vista and XP and they have different temp paths. How I can get it without losing compatibility? ...

Passing a modifiable parameter to c++ function

Hi, everyone! Provided, I want to pass a modifiable parameter to a function, what should I choose: to pass it by pointer or to pass it by reference? bool GetFoo ( Foo& whereToPlaceResult ); bool GetFoo ( Foo* whereToPlaceResult ); I am asking this because I always considered it the best practice to pass parameter by reference (1), b...

Win32 API for getting the language(localization info) of the OS??

Can anybody please help me with how to get the language(english,chinese etc) of Windows OS through win32 API(C/C++)?? Thanks, Sourabh ...

Bit twiddling: find next power of two with templates in c++

This is a follow-up to my general question: bit-twiddling-find-next-power-of-two I have now created the following template function: template <typename T> T nextPowerOfTwo(T n) { std::size_t k=1; n--; do { n |= n >> k ; k <<=1; } while (k < sizeof(T)*8) return ++n; } 2 Questions: Specifying ...

Piecewise conversion of an MFC app to Unicode/MBCS

I have a large MFC application that I am extending to allow for multi-lingual input. At the moment I need to allow the user to enter Unicode data in edit boxes on a single dialog. Is there a way to do this without turning UNICODE or MBCS on for the entire application? I only need a small part of the application converted at the moment...

problems with global variables in shared library project (C++)

i have a problem with global variables in a c++ shared library project. my library has to be working as a standard g++ shared library (.so) as well as a dll. i did this by creating files libiup_dll.cpp and libiup_dll.h, where i have something like #ifdef BUILD_DLL // code for the dll: wrapper functions around the classes in my shared l...

sizeof() And Template Argument In ctor / Non-ctor Function

I hit a snag today... I wanted to define a small templated helper class: template<class T> CMyClass { public : CMyClass() { size_t iSize = sizeof(T); } // Allowed. size_t GetElementSize() const { return sizeof(T); } // C2027. }; and of course, it wouldn't compile (C2027). My question was, is it possible to get the size of t...

Is there a way to have a capture repeat an arbitrary number of times in a regex?

I'm using the C++ tr1::regex with the ECMA regex grammar. What I'm trying to do is parse a header and return values associated with each item in the header. Header: -Testing some text -Numbers 1 2 5 -MoreStuff some more text -Numbers 1 10 What I would like to do is find all of the "-Numbers" lines and put each number into its own re...

how to read numbers from an ascii file (C++)

i need to read in data files which look like this: * SZA: 10.00 2.648 2.648 2.648 2.648 2.648 2.648 2.648 2.649 2.650 2.650 2.652 2.653 2.652 2.653 2.654 2.654 2.654 2.654 2.654 2.654 2.654 2.654 2.654 2.655 2.656 2.656 2.657 2.657 2.657 2.656 2.656 2.655 2.655 2.653 2.653 2.653 2.654 2.658 2.66...