c++

Global variable destructors not called, where to start?

I'm faced with the problem that my applications global variable destructors are not called. This seems to occur only if my application successfully connects to an oracle database (using OCI). I put some breakpoints in the CRT and it seems that DllMain (or __DllMainCRTStartup) is not called with DLL_PROCESS_DETACH, thus no atexit() is ca...

Can't write TIFF files using Libtiff on Mac

I use libtiff3.9.4 for reading and writing TIFF files in c++ on my mac. My project is written to be portable and runs without any issues on both Windows 32-bit og Ubuntu 64-bit. But on the mac the Libtiff function TIFFWriteScanline always fails (it returns != 1). The TIFF file is created, but it does not have any contents. I have tried ...

Good practice for choosing an algorithm randomly with c++

Setting: A pseudo-random pattern has to be generated. There are several ways / or algorithms availible to create different content. All algorithms will generate a list of chars (but could be anything else)... the important part is, that all of them return the same type of values, and need the same type of input arguments. It has to be p...

How to convert 'char' or ''TBuf' to 'TPtrC8'?

I've a question concerning a conversion from char to TPtrC8 on Symbian. How can I transform a char to TPtrC8 or a TBuf to TPtrC8? Is there a simple and quick way to do that? ...

Why in this call to AfxWinInit I get a warning C6309 ???

Hello, while doing some static code analysis I've found a weird one. On a call like this one: if(!AfxWinInit(moduleHandle,NULL,::GetCommandLine(),0) I get the warning C6309 at the second parameter (C6309: argument 2 is null: it does not adhere to function specification of AfxWinInit) Docs say that for Win32 applications the second p...

Fatal error from incrementing loop.

Currently, I'm trying to make a function that sorts a vector full of fighters in the function sortFighters in the Fighter.cpp file. It all seems to compile correctly; However, when it does run, I get a fatal error in one of the lines of the aformentioned .cpp file. I know exactly what the problem is, and put a comment there accordingly. ...

Handling Exceptions in a critical application that should not crash

I have a server application which I am debugging which basically parses scripts (VBscript, Python, Jscript and SQl) for the application that requests it. This is a very critical application which, if it crashes causes havoc for a lot of users. The problem I am facing is how to handle exceptions so that the application can continue and ...

Where shall I find Questions to be put up in a Coding contest?

Err....I guess this aint correct place to ask this question... But i couldn't find any place where i could get the desired coding problems, that i should put up in a Coding contest, which we are organizing as a part of our college function & I really want the Problems to be Advanced! ...

Dealing with large amounts of data in c++

I have an application that sometimes will utilize a large amount of data. The user has the option to load in a number of files which are used in a graphical display. If the user selects more data than the OS can handle, the application crashes pretty hard. On my test system, that number is about the 2 gigs of physical RAM. What is a ...

Memory address of reference variable

Possible Duplicate: Is there any way to find the address of a reference? When we print the address of actual variable and reference variable it shows same address why? ...

Camera rotation (OpenGL)

I am having trouble with a camera class I am trying to use in my program. When I change the camera_target of the gluLookAt call, my whole terrain is rotating instead of just the camera rotating like it should. Here is some code from my render method: camera->Place(); ofSetColor(255, 255, 255, 255); //draw axis lines //x-axis g...

C++ How to replace a function but still use the original function in it?

I want to modify the glBindTexture() function to keep track of the previously binded texture ID's. At the moment i just created new function for it, but then i realised that if i use other codes that use glBindTexture: then my whole system might go down to toilet. So how do i do it? Edit: Now when i thought it, checking if i should bin...

C++: calling a virtual base class's overloaded constructor

Hi, is there a (practicable) way to by-pass the normal (virtual) constructor calling order? (Hard to describe in one sentence, see the) Example: class A { const int i; public: A() : i(0) { cout << "calling A()" << endl; } A(int p) : i(p) { cout << "calling A(int)" << endl; } }; class B : public...

How does this work?

In applications like Adobe Illustrator, they have a way to simplify a path. I'm not sure how this works exactly. Given a path with points which have 2 bezier handles each (for cubic bezier), how could I go about simplifying the path? Thanks ...

Creating web-browser playable webm files with vp8 SDK ?

I'm using the vp8 SDK (www.webmproject.org) to create a vp8-encoded video file. However, the SDK sample produces an IVF file, which the browser doesn't play. I know the webm format is a matroska container so I guess I should store the video data in that format, but the mkv format specification is lengthy and complex and I don't think I ...

What key was pressed? Keyboard hooks

I'm using low level hooks, but I can't determine what key was pressed. Values are the same for every single key. Is here something I'm doing wrong? Hook method void hook() { /** this part is probably not important since I use global WH_KEYBOARD_LL, is that right? */ HWND hwnd = FindWindow(NULL, "Vertices.exe"); HINSTANCE i...

Writing a simple ActiveX control for IE that has one method

I'm learning how to write a scriptable ActiveX control. My goal is to have a tiny control that can check to see if something is installed on the system. What I've done so far is: Create a MFC ActiveX control project in VS2008 Add some 'safe for scripting' bits that I found here. Extend the IDL to provide my "IsInstalled" method, which ...

How do I determine the return type of a given array type's subscript operator with boost?

What type signature would I need to use if I'd like to determine the type returned by an array (T)'s subscript operator using boost? Note that the arrays for which I would be using this do not contain typedefs and are third-party. Example. I want to determine that: SomeArray<int> tmp(1); int& somevalue = tmp[0]; //would equate ty...

Undefined reference question

When I try compiling this: #include "OriAudioCache.hpp" int main() { System *audioSystem(0); FMOD_RESULT result; result = System_Create(&audioSystem); FMOD_CHECK_STATE(result); OriAudioCache cache(audioSystem, 20); string title("Ambitious Girl"); string path("/home/findrzkeeprz/Desktop/Resources/The_Ambitiou...

Boost::tribool: odd behaviour, or bug?

I'm exploring boost::tribool and was surprised by the following behaviour. { using namespace boost; boost::tribool t(indeterminate); assert(t==indeterminate); // This assertion fails! } However, if I do this, the assert passes. assert(indeterminate(t)); No compiler warnings or errors in either case. Anyone have a good explanati...