c++

How do I load and save an image from an SQL Server database using GDI+ and C++?

I need specifically to load a JPG image that was saved as a blob. GDI+ makes it very easy to retrieve images from files but not from databases... ...

Is there a way to implement layers in GDI+?

My idea would be to draw several Graphics objects on memory and combine them when drawing the image. But I haven't got a precise idea of how to do that. Shall I use GraphicsContainer's? Or save the objects as Metafile's? (these are temporary objects, I would like to keep them on memory) ...

Hotkeys override

Difficult question. The answer is probably no, if all I found in the Intertubes is right, but it is worth a try. I need to override the CTRL+SHIFT+ESC and the CTRL+ESC combinations. It would be good to be able to override the WIN key combinations, but I have a low level hook that does such, I only wish I didn't need it. If I can manage t...

Storing PCRE compiled regexes in C/C++

Is there an efficient way to store the compiled regexes (compiled via regcomp(), PCRE) in a binary file, so that later I can just read from the file and call regexec()? Or is it just a matter of dumping the compiled regex_t structs to the file and reading them back when needed? ...

What will pNext be in the following case using C/C++?

func() { Object* pNext; func1(pNext); } func1(Object* pNext) { pNext = Segement->GetFirstPara(0); } I was expecting it to be pointer to firstpara returned from func1() but I'm seeing NULL can some explain and how to fix it to actually return the firstpara() pointer? ...

Which is better BOOST_MPL_ASSERT or BOOST_STATIC_ASSERT?

As I recall BOOST_MPL_ASSERT was once preferred. Is this still true? Anyone know why? ...

Is there an easy way to find small open source projects?

It was suggested to me by the SO community to get into an open source project to get myself out there. Id like to find one that is preferably a small project (file size/project size). I figure getting into something that is small will help me get into something that wont take long to understand and start contributing. I tried the big op...

How is tr1::reference_wrapper useful?

Hi, recently I've been reading through Scott Meyers's excellent Effective C++ book. In one of the last tips he covered some of the features from TR1 - I knew many of them via Boost. However, there was one that I definitely did NOT recognize: tr1::reference_wrapper. How and when would I use tr1::reference_wrapper? ...

What is a good use case for tr1::result_of?

I hear that tr1::result_of gets used frequently inside of Boost... I'm wondering if there are any good (simple) use cases for tr1::result_of I can use at home. ...

atoi() conversion error

atoi() is giving me this error: error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast from this line: int pid = atoi( token.at(0) ); where token is a vector how can i go around this? ...

Pros & Cons of putting all code in Header files in C++ ?

You can structure a C++ program so that (almost) all the code resides in Header files. It essentially looks like a C# or Java program. However, you do need at least one .cpp file to pull in all the header files when compiling. Now I know some people would absolutely detest this idea. But I haven't found any convincing downsides of doing ...

Are there any good open source BDD tools for C/C++?

I love the Ruby RSpec BDD development style. Are there any good tools for doing this with C/C++? ...

Is CGI in any way bettern than Servlets?

We have a web reporting application that was built with cgi (C/C++) 10 years back. Due to performance and security issues, it needs to be rearchitectured. What could be the best technology solution to re-engineer the cgi based architecture? ...

How to parse a string to an int in C++?

What's the C++ way of parsing a string (given as char *) into an int? Robust and clear error handling is a plus (instead of returning zero). ...

Accessing protected members from subclasses: gcc vs msvc

In visual C++, I can do things like this: template <class T> class A{ protected: T i; }; template <class T> class B : public A<T>{ T geti() {return i;} }; If I try to compile this in g++, I get an error. I have to do this: template <class T> class B : public A<T>{ T geti() {return A<T>::i;} }; Am I not supposed to do ...

How to paralleize search for a string in a file with a help of fork? (GNU Linux/g++)

This is how the situation looks: I got a text file with a couple of lines and I am looking for a string in this file. I need to pass following command line parameters to the program: - file path - the string I am looking for - maximum number of processes the program is allowed to "fork" in order to complete this task. How to such pr...

Looking for an open source Traveling Salesman function / library in c / c++?

I know there are a few different Traveling Salesman projects out there and I've played with LKH a bit, but I was wondering if anyone had any recommendations on any other ones? My project is GPL'ed so I would need something that is compatible with that license. ...

string c_str() vs. data()

Hi, I have read several places that the difference between c_str() and data() (in STL and other implementations) is that c_str is always null terminated while data is not. As far as I have seen in the actual implementation, they either do the same or data() calls c_str(). What am I missing here? Which one is more correct to use in whic...

What language/platform would you recommend for CPU-bound application?

I'm developing non-interactive cpu-bound application which does only computations, almost no IO. Currently it works too long and while I'm working on improving the algorithm, I also think if it can give any benefit to change language or platform. Currently it is C++ (no OOP so it is almost C) on windows compiled with Intel C++ compiler. ...

Any C++ libraries available to convert between floating point representations?

I recently had a need to interpret a DEC 32-bit floating point representation. It differs from the IEEE floating point representations in the number of bits allocated to the exponent and mantissa. Here's a description of a bunch of floating point formats: http://www.quadibloc.com/comp/cp0201.htm I managed to roll my own C++ code to s...