c++

Using Libjpeg to decompress JPEG data that is in memory

I have found a link that I think is showing me how to do what I want to do, but I need a bit of help getting to grips with this I have a pointer to my JPEG data in memory, I want to get the the raw RGB data out of it. I also will be calling this function over and over, so I figure that if I can put some of pull some of this stuff out an...

is libstdc++ reentrant library ?

Hi, I am using libstdc++ on MAC for developing extensions for firefox. I am getting crashes inside libstdc+ library when I am referring to it across multiple firefox extensions. I was thinking whether libstdc++ for XCode compiler is reentrant or not. If not, is there any version of libstdc++ is available with is reentrant ? ...

does cvrelease delete the allocated memory?

Hello. This might be the wrong way of doing things, but I pass an array from LabView into my C++ function as a simple array of char. I then create an OpenCV image and point the pointer to my data that was passed. At the end of the function I use cvReleaseImage to delete all the OpenCV images, would that remove the data off my original p...

mismatch in formal parameter list

\a3.cpp(75): error C2563: mismatch in formal parameter list im certain im passing the fuction checkout with 3 doubles, i dont know why im getting the error i am. Please help #include <iostream> #include <cstdlib> using namespace std; const double peanut_PRICE = 1.80; const double peanut_SHIP = 0.50; const double BOOK_PRICE = 9...

Timer working improperly

I have a problem with a timer class based on a SDL timer. class CTimer { public: CTimer(): startTick(0), endTick(0), curTime(0), running(false) {}; void Start() { startTick += SDL_GetTicks() - endTick; running = true; }; void Stop() { endTick = SDL_GetTicks(); running = false; }; void Reset() { startTick = 0; endTick...

Speed up compilation in Visual Studio 2005

What are the best ways to speed up compilation time in Visual Studio 2005 for a solution containing mainly C++ projects? ...

What is my compiler doing? (optimizing memcpy)

I'm compiling a bit of code using the following settings in VC++2010: /O2 /Ob2 /Oi /Ot However I'm having some trouble understanding some parts of the assembly generated, I have put some questions in the code as comments. Also, what prefetching distance is generally recommended on modern cpus? I can ofc test on my own cpu, but I was h...

Error when trying to access web browser from windows application

I am trying to access open IE instance from my desktop application. Code is IHTMLDocument2 *pDoc; LRESULT lr; HRESULT hr; if ( SendMessageTimeout( hwndChild, uMsg, 0L, 0L, SMTO_ABORTIFHUNG, 1000, (DWORD_PTR *) &lr ) ) { hr = ObjectFromLresult( lr, IID_IHTMLDocument2, 0, (void**)&pDoc ); if ( SUCCEEDED( hr ) ) { IWebBrowser2 *...

Order of execution in constructor initialization list

Is order of execution in constructor initialization list determinable? I know that members order in a class is the order in which those members will be initialized but if I have scenario like this: class X() { X_Implementation* impl_; }; and then providing that allocator is available: X::X():impl_(Allocate(sizeof(X_Implementation)))...

Get content of another window

Hi, I'm totally lost here. I want to grab the visual content of a window for further processing, inside my console application. I know how to find the HWND, but from that I don't know what to do to get the content. The application I want to grab is 3D, but I don't know if its Direct3D or OpenGL, but I need to process every frame (some fr...

map that can take any basic type inside

I need to create a map that can contain as its value any basic data type such as double,float,string, char etc... to store values from a request for a server component. I was thinking of using a map such as this: std::map<std::string, void*>, however I don't know that this is a very good solution. I wondered if anyone can advice on a b...

Is there any way to pass a std::string to a function that accepts a char* and changes its contents?

I'm trying to get back into programming, specifically console games. I'd heard that curses was good for that, so I found a curses tutorial and I'm getting into that. I'm using C++, and naturally I wanted to take advantage of std::string, but functions like getstr() only accept char*. Is there any way to pass a string as a char*, or am I ...

wxWidgets 2.9 custom events

I appear to have followed this example (found under "Defining Your Own Event Class"), and my code compiles and runs without error, but I'm not catching the event anywhere. The code: class MyCustomEvent : public wxEvent { //... stuff here }; wxDEFINE_EVENT(MY_CUSTOM_EVENT_1,MyCustomEvent); and later I bind the event: Bind(MY_CUSTOM_E...

How To Navigate Boost

I was reading over Boost ConceptCheck today, and encountered this warning in the implementation page: This documentation is out-of-date; similar but newer implementation techniques are now used. This documentation also refers to components and protocols in the library's old interace such as BOOST_CLASS_REQUIRES and constraints() fun...

Why is WebKit written in C++ and not in ObjectiveC

Apple is the backing force of ObjectiveC. However WebKit is written in C++. Apart from portability (not all systems have ObjectiveC compilers/runtimes) is there any other valid reason for this? Performance, features? Lately Apple does not seem to care of other languages than ObjectiveC. ...

Is "program to interfaces" a common design principle in C++ projects?

I read a lot about "program to interfaces" and "inversion of control" during the last days. Mostly in the context with the Java language. My question is if it is also a common practice in C++ development. What are the advantages? What are the disadvantages? Is it worth to apply to small projects (like 15-20 classes)? ...

Thread-safe copy constructor/assignment operator

Hi, Let's say that we want to make class A thread-safe using an std::mutex. I am having my copy constructor and assignment operator similarly to the code below: #include <mutex> class A { private: int i; mutable std::mutex mtx; public: A() : i(), mtx() { } A(const A& other) : i(), mtx() { std::lock_guard<std::mutex> _l...

C++ templates to make several version of function with different constant

Hello Can I use template to create several instantiations of some function, different only in some constant parameter? The number of alternatives for this parameter is fixed. E.g. I want not to rewrite (where upper is in 1..32 in powers of two) funct(param, int upper) { some_loops(..) some_heavy_code_fast_for_const_and_slow_f...

C++, need help with pointers created with strcat!!!

I need to append a number at the end of the word flare depending on how many I have. That part works great. My problem is when I go to print it to the screen. I would like the program to output the value of what (Camera::Table[Id]->sensor->flare1) sensor is pointing at, in this case, flare one. If the program were to continue it would ou...

URLOpenPullStream and gzip content download - need uncompressed data

I am using URLOpenPullStream along with a IBindStatusCallback and IHttpNegotiate callbacks to handle the negotiate, status, and data messages. Problem that I have is when the content is gzip (e.g. Content-Encoding: gzip). The data that I am receiving via OnDataAvailable is compressed. I need the uncompressed data. I am using BINDF_...