c++

How to detect when an exception is in flight?

In C++ (MSVC) how can I test whether an exception is currently "in flight". Ie, code which is being called as part of a class destructor may be getting invoked because an exception is unwinding the stack.. How can I detect this case as opposed to the normal case of a destructor being called due to a normal return? ...

function with AnsiString params dll call in qt project

I have dll that written on Borland C++. I heed to call function with AnsiString params in this dll from my qt c++ project. ...

Problem with qhttp example qt 4.4.3

hi i'm new here. i'm trying to use qhttp for a update app. but there is a problem for me wich i can not solve. here is the problem: i try to download a file(works perfectly) but if there is no connection to the www the file is created but has 0byte, so that my old file is overritten, which is not so good for the application trying to use...

Win32: Monitoring for files being created or changed

1) How can I use FindFirstChangeNotification / FindNextChangeNotification + ReadDirectoryChanges to detect certain files being created or removed? 2) Is the FILE_NOTIFY_CHANGE_LAST_WRITE a reliable indicator of a file change? Application: I have an explicit list of files that may be located in different folders. Display contents depe...

Passing a C++ method to an Objective-C method

I have a C++ class 'Expression' with a method I'd like to use in my Objective-C class 'GraphVC'. class Expression { double evaluate(double); } And my Objective-C class: @implementation GraphVC : UIViewController { - (void)plot:(double(*)(double))f; @end I thought that it would be easiest to pass around function pointers that ta...

Visual C++ 2008 Boost Problem

Hey I'm using the C++ Communication Services Framework, which uses the Boost's Thread library. I'm compiling one of their test projects (CSF's) and i'm getting a huge errors The errors are in the Boost Bind library in file bind/mem_fn_template.hpp EDIT: I installed Boost through the Boost installers provided by BoostPro Here are few ...

Why do some of my keyboard events work and others do not?

I have the following examples in c++, the first works as expected the second does not. I also note that the Windows System keyboard has the same problem. Anybody know why or a work around/better way of doing this? keybd_event(VK_LWIN,0x5b,0 , 0); /* Windows Key Press */ keybd_event(VkKeyScan('l'), 0, 0, 0); /* L key Press */ keybd_eve...

Create a background process with system tray icon

I'm trying to make a Windows app that checks some things in the background, and inform the user via a systray icon. The app is made with Not managed C++ and there is no option to switch to .net or Java. If the user wants to stop the app, he will use the tray icon. The app can't be a Service because of the systray side and because it ...

Memory Allocation Crash

I have stumbled accross a strange problem in which I cannot understand. I am not an expert at C/C++ so bear with me. I have an NPC class, which derives from a Player class, which derives from a Sprite class. The sprite class contains a setupAnimation function, which allocates an array of floats containing coordinates on the texture, each...

How do I initialize a static std::map?

I've made a message-only window class, and I'm trying to map HWNDs back to the objects with those handles. I'm trying to do that using a private static std::map<HWND, CMyClass*> belonging to the class, like this: MyClass.h: class CMyClass { ... private: HWND m_hWnd; HINSTANCE m_hInstance; LPCSTR m_szClas...

web application image processing

I'm writing a web application whose sole intention is to process the images provided by the user. I do understand that a multitude of programming languages facilitate server-side image manipulation and some basic functionality etc., but my concern here is which might be the best programming language/ libraries for exhaustive image proce...

Destructor that calls a function that can throw exception in C++

I know that I shouldn't throw exceptions from a destructor. If my destructor calls a function that can throw an exception, is it OK if I catch it in the destructor and don't throw it further? Or can it cause abort anyway and I shouldn't call such functions from a destructor at all? ...

Why default return value of main is 0 and not EXIT_SUCCESS ?

Hello, the iso 1998 c++ standard specifies that not explicitly using a return statement in the main is equivalent to use "return 0". But what if an implementation has a different standard "no error" code, for example "-1" ? Why not use the standard macro "EXIT_SUCCESS" that would be replaced either by "0" or "-1" or any other value de...

Operator Overloading in C++ as int + obj

Hi Guys, I have following class:- class myclass { size_t st; myclass(size_t pst) { st=pst; } operator int() { return (int)st; } int operator+(int intojb) { return int(st) + intobj; } }; this works fine as long as I use it like this:- char* src="This is test string"...

Representing 128-bit numbers in C++

What's the best way to represent a 128-bit number in C++? It should behave as closely to the built-in numeric types as possible (i.e. support all the arithmetic operators, etc). I was thinking of building a class that had 2 64 bit or 4 32 bit numbers. Or possibly just creating a 128 bit block of memory and doing everything myself. Is t...

extracting compressed file with boost::iostreams

Hi I'm searching for a way to extract a file in c++ by using the boost::iostreams classes. There is an example in the boost documentation. But it outputs the content of the compressed file to std::cout. I'm looking for a way to extract it to a file structure. Does anybody know how to do that? Thanks! ...

What's the C++ GUI building option with the easiest learning curve - VS/Qt/wxWidgets/etc.?

I'm looking to be able to build GUI applications quickly and painlessly as possible. I'm competent (though not expert, and have no formal training) in C++, but have never used a GUI building toolkit or framework or anything. I am not a professional programmer and am totally inexperienced and ignorant when it comes to building GUI apps. H...

C++ interpreter / console / snippet compiler

Hi, I am looking for a program where I can enter a C++ code snippet in one window, press a button, and get output in another window. Compilation should somehow be hidden behind the button. On a per-snippet basis would be fine, full interactive probably asking too much. It should run under Linux/Unix. Main use case would be learning/tes...

Boost: How to deserialize inside a method?

I have a problem deserializing data serialized using Boost.Serialization. I want a method like this DataObject* Transmitter::read(). DataObject is the parent class of multiple classes that can be send using Transmitter::write(DataObject& data). What I have at the moment looks like this, but it doesn't work. DataObject* Transmitter::rea...

How to cross-platform port unix pipes?

I have a code that looks like this: uses this library #include <unistd.h> #define READ_FD 0 #define WRITE_FD 1 int m_pipe[2]; if(pipe(m_pipe) != -1) { unsigned long Id = gdk_input_add(m_pipe[READ_FD], GDK_INPUT_READ, Callback, (gpointer)this); } and it surprisingly builds on both linux(all major flavors: AS3, AS5, solaris) an...