c++

Fast library to replace CDC vector graphics

I have a mature MFC C++ application that displays on screen and prints using CDC wrappings on the Win32 GDI. While it has been optimized over the years, I would like to replace it with something a bit faster. The graphics included rendered triangular surface models, complex polylines and polygons, and lots of text. It needs to meet th...

Use Compiler/Linker for C++ Code Clean-up

I'm using VS2008 for a C++ project. The code is quite old and has passed through many hands. There are several classes hierarchies, functions, enums and so on which are no longer being used. Is there a way to get the compiler/linker to list out identifiers which have been declared or defined but are not being referred to anywhere? ...

How to manage a simple PHP session using C++ cURL (libcurl)

I'm writing a C++ client which is using libcurl for communicating with a PHP script. The communication should be session based, and thus the first task is to login and make the PHP script set up a session. I'm not used to working with sessions either from C++ or PHP. I basically know that it has to do with cookies and communicating ses...

How to get folder sharing on Windows Mobile emulator to work

I am developing an application using Windows Mobile 5.0, under embedded VC++ 4.0, and using the emulator for debugging. I need to copy some files onto the emulator and planned on using the option to map a directory to the emulator storage card. Problem is, this option is greyed out when I run the emulator. From the emulator help i get ...

How to setup a linux C++ project in Eclipse?

I have an existing C++ project on a linux environment, and would like to import it into the Eclipse IDE. Not sure if I should start a new Eclipse C++ project, or if there was some way to import the source files? ...

What's the term for this? [found, fluent interface]

What's the term for this design? object.method1().method2().method3() ..when all methods return *this? I found the term for this a while ago, but lost it meanwhile. I have no clue how to search for this on google :) Also if anyone can think of a better title for the question, feel free to change it. Thanks Update-Gishu: After readi...

Returning Objects in C++

When returning objects from a class, when is the right time to release the memory? Example, class AnimalLister { public: Animal* getNewAnimal() { Animal* animal1 = new Animal(); return animal1; } } If i create an instance of Animal Lister and get Animal reference from it, then where am i supposed to delete it? int ...

What should main() return in C/C++?

What way is the most efficient and why? int main()? void main()? return 1? return 0? ...

Splitting a already split pane (MFC)

In my MFC program I am using a splitter to create two panes. I now want to split one of these panes in half again and put in another view, can someone talk me through how to do it or point me in the direction of some code? I would prefer to code it myself so I am not interested in custom derived classes unless they are extremely basic. ...

Checking for overflow of 64-bit integers in C++

In my current 32-bit application, I check (very occasionally) for overflow by doing operations on 64-bit integers. However, on 64-bit systems there does not seem to be a standard 128-bit integer. Is there a simple way of checking for overflow, or a way of getting 128-bit integers, which works on all OSes and compilers? I tried using GM...

How do I input 4-byte UTF-8 characters?

I am writing a small app which I need to test with utf-8 characters of different number of byte lengths. I can input unicode characters to test that are encoded in utf-8 with 1,2 and 3 bytes just fine by doing, for example: string in = "pi = \u3a0"; But how do I get a unicode character that is encoded with 4-bytes? I have tried: str...

Where can I look at the C++ standard

I want to use STL with the current program I'm working on and the vendor doesn't support what I feel is a reasonable STL, working is not my idea of reasonable. I have been unable to find a C++ Standard or an STL standard that is not just an API that leaves me wondering if my interpretation is correct or if the vendor interpretation is c...

static const Member Value vs. Member enum : Which Method is Better & Why?

If you want to associate some constant value with a class, here are two ways to accomplish the same goal: class Foo { public: static const size_t Life = 42; }; class Bar { public: enum {Life = 42}; }; Syntactically and semantically they appear to be identical from the client's point of view: size_t fooLife = Foo::Life; size_...

Is there a C++ decompiler?

I have a program in which I've lost the C++ source code. Are there any good C++ decompilers out there? I've already ran across Boomerang. ...

CMapStringToOb::Lookup problem in Japanese

Does anyone know why CMapStringToOb::Lookup doesn't work in Japanese? The code loads a string from the string table, and puts it into a CMapStringToOb object. Later it loads the same string from the string table (so it is guaranteed to be exactly the same) and calls CMapStringToOb::Lookup to find it. It works in all languages that we'v...

ActiveX plugin causes ASSERT to fail on application exit in VS2008

My MFC application using the "ESRI MapObjects LT2" ActiveX plugin throws an ASSERT at me when closing it. The error occurs in cmdtarg.cpp: CCmdTarget::~CCmdTarget() { #ifndef _AFX_NO_OLE_SUPPORT if (m_xDispatch.m_vtbl != 0) ((COleDispatchImpl*)&m_xDispatch)->Disconnect(); ASSERT(m_dwRef <= 1); //<--- Fails because m_dwRef i...

openGL SubTexturing

I have image data and i want to get a sub image of that to use as an opengl texture. glGenTextures(1, &m_name); glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldName); glBindTexture(GL_TEXTURE_2D, m_name); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexIm...

C/C++: Passing variable number of arguments around

Say I have a C function which takes a variable number of arguments: How can I call another function which expects a variable number of arguments from inside of it, passing all the arguments that got into the first function? Example: void format_string(char *fmt, ...); void debug_print(int dbg_lvl, char *fmt, ...) { format_string(f...

Does anyone have a link to Sun's name mangling patent?

I've seen a lot of mentions like this one that Sun has patented their name mangling scheme for C++. It's certainly true that Sun's name mangling is much more efficient than the scheme used by IBM's xlC compiler, for example. But I can't find the actual patent anywhere. Does anyone have the patent #, or a link to the patent? Thanks! ...

Best Portable way to connect to SQL server using c++

Hi everyone, I need some help into this problem: Basically i want to connect my program which uses c/c++ to a SQL server database (MS SQL server express or standard edition) , because of our users demands the program needs to be ported to Mac Os too so this connection need to be portable. Any idea of a portable API i can use to do t...