c++

create sql query in c++/java?

which method do you prefer for creating dynamic sql queries? formating or streaming? Is it just preference or there any reason one is better than other?Or any special library you use to it. EDIT: Please answer in case of c++. ...

Converting binary data to printable hex

In this thread some one commented that the following code should only be used in 'toy' projects. Unfortunately he hasn't come back to say why it's not of production quality so I was hoping some one in the community may be able to either assure me the code is ok (because I quite like it) or identify what is wrong. template< class T1, cla...

How do I get the HWND for an ActiveX control after the control has been initialised/activated?

I am creating an ATL 8.0 based ActiveX control in C++ using Visual Studio 2008. I need to create a sub-window and attach it to the ActiveX control. How do I get access to the HWND that is owned by the ActiveX control? Which ATL function can I override in order to use the HWND after the control's window has been created? ...

dlopen on library with static member that throws exception in constructor - results in Abort

I am trying to load a dynamic library using dlopen function. This library contains a static object, which throws an exception in its constructor. I have a "try-catch(...)" block around the dlopen call, but it doesn't catch the exception, and I just see "Abort" printed. How am I able to catch this exception? ...

Propagating C++ exceptions across C stack frames on OS X

Hello everyone, The application I'm working on (it's a game, actually) uses XML for some of its configuration. Since I'm using CEGUI for the GUI, and it has its own XML parsing objects, I converted my code to use that instead of my own hand-rolled parser class. If the document is missing attributes on certain tags, it throws an except...

Lazy evaluation in C++

C++ does not have native support for lazy evaluation (as Haskell does). I'm wondering if it is possible to implement lazy evaluation in C++ in a reasonable manner. If yes, how would you do it? EDIT: I like Konrad Rudolph's answer. I'm wondering if it's possible to implement it in a more generic fashion, for example by using a parametr...

The latest version of gcc to use libstdc++.so.5

What is the latest version of gcc that still uses libstdc++.so.5 (as opposed to libstdc++.so.6)? ...

Compiling with g++ using multiple cores

Quick question: what is the compiler flag to allow g++ to spawn multiple instances of itself in order to compile large projects quicker (for example 4 source files at a time for a multi-core CPU)? Many thanks. ...

const_cast for vector with object

I understand that const_cast to remove constness of objects is bad, I have the following use case, //note I cannot remove constness in the foo function foo(const std::vector<Object> & objectVec) { ... int size = (int) objectVec.size(); std::vector<Object> tempObjectVec; //Indexing here is to just show a part of the vecto...

How can I read and manipulate CSV file data in C++?

Pretty self-explanatory, I tried google and got a lot of the dreaded expertsexchange, I searched here as well to no avail. An online tutorial or example would be best. Thanks guys. ...

What are core concept differences between C++ and C#?

Let assume one knows C++, what are the main concepts that can confuse them/that work differently when using C#? I do not mean the syntax differences but for example how references works, what "replaces" pointers, etc. or how the idea of managed code affects developer experience? EDIT: Thanks to Chris for pointing out this great blog po...

CFileImageLoader(LPCTSTR lpszFileName);

I have a class which expects a LPCTSTR. When i call : new CFileImageLoader(_T("Splash02.png")) OR new CFileImageLoader("Splash02.png") both don't work. Why ? I'm new to cpp... Thanks Jonathan d. ...

Windows Mobile WAP Wakeup

could anyone please give me directions, or better - a working sample, of using the "WAP Wakeup" feature in Windows Mobile? I'm trying to follow directions from http://msdn.microsoft.com/en-us/library/aa919167.aspx . Unfortunately, they only give the beginning of the solution. Step 1: register your application to listen to SMS messages ...

VisualStudio *.obj files size (513Mb objs and 534Mb lib)

Hi. I'm a C++ developer and using Visual Studio 2008. How can I reduce *.obj files size? I've read http://stackoverflow.com/questions/332946/why-are-my-visual-studio-obj-files-are-massive-in-size-compared-to-the-output-e but didn't find the answer. When I build project to a static lib total size of all *.obj files is 513Mb and resultin...

MFC and STL

Would you mix MFC with STL? Why? ...

Boost Thread tutorials

Not really a question, more of a reference list: Boost.Thread was heavily modified since 1.34, to conform to upcoming C++0x standard. Thus, most tutorials I can find on the web can be considered obsolete. Today, Boost's version is 1.37, and the only links I found on the web were: Boost 1.37 Threads http://www.boost.org/doc/libs/1_37_...

Assignment inside function that is passed as pointer?

ClassA* pa = NULL; ClassA* pb = NULL; assignObject(ClassA* pa,ClassB* pb) { pa = new ClassA; pb = new ClassB; } what will be the value of pa,pb after executing the function EDIT how to pass as pointer is the return if pa,pb is NULL ...

is f(void) deprecated in modern C and C++

I'm currently refactoring/tidying up some old C code used in a C++ project, and regularly see functions such as int f(void) which I would tend to write a int f() Is there any reason not to replace (void) with () throughout the codebase in order to improve consistency, or is there a subtle difference between the two that I am unaw...

What to put in a binary data file's header

I have a simulation that reads large binary data files that we create (10s to 100s of GB). We use binary for speed reasons. These files are system dependent, converted from text files on each system that we run, so I'm not concerned about portability. The files currently are many instances of a POD struct, written with fwrite. I need...

Symbian C++ - Load and display image from .mbm file

I have a .mbm file that I copy to my device using this line in the .pkg file "$(EPOCROOT)epoc32\data\z\resource\apps\MyApp.mbm" -"!:\resource\apps\MyApp.mbm" Then in the draw function of my container I do this.. _LIT(KMBMFile , "\\resource\\apps\\MyApp.mbm" ); CFbsBitmap* iBitmap; iBitmap->Load(KMBMFile, 0); gc.BitBlt(Rect().iTl, iB...