c++

How do you iterate through every file/directory recursively in standard C++

How do you iterate through every file/directory recursively in standard C++ ...

Dynamically sorted STL containers

I'm fairly new to the STL, so I was wondering whether there are any dynamically sortable containers? At the moment my current thinking is to use a vector in conjunction with the various sort algorithms, but I'm not sure whether there's a more appropriate selection given the (presumably) linear complexity of inserting entries into a sort...

What's the best Free C++ Profiler for windows (if there are)

Hi, I'm looking for a profiler in order to find the bottleneck of my c++ code. I'd like to find a free, non intrusive, good profiling tool. I'm a game developer and I use PIX for Xbox360, I found it very good (but not free) I know the Intel v-Tune, but it's not free. There exists any free profiling tool? ...

Why do we need extern "C"{ #include <foo.h> } in C++?

Specifically: When should we use it? What is happening at the compiler/linker level that requires us to use it? How in terms of compilation/linking does this solve the problems which require us to use it? ...

How do I convert jstring to wchar_t *

Let's say that on the C++ side my function takes a variable of type jstring named myString. I can convert it to an ANSI string as follows: const char* ansiString = env->GetStringUTFChars(myString, 0); is there a way of getting const wchar_t* unicodeString = ... ...

Switching from C# to C++. Any must-reads?

I'm trying to find a least-resistance path from C# to C++, and while I feel I handle C# pretty well after two solid years, I'm still not sure I've gotten the "groove" of C++, despite numerous attempts. Are there any particular books or websites that might be suitable for this transition? ...

Using XmlRpc in C++ and Windows

I need to use XmlRpc in C++ on a Windows platform. Despite the fact that my friends assure me that XmlRpc is a "widely available standard technology", there are not many libraries available for it. In fact I only found one library to do this on Windows, (plus another one that claims "you'll have to do a lot of work to get this to compi...

How to start/plan a software project for data collection on a PDA/handheld device.

A friend is having mysterious health problems that we're trying to track down. One thing that would help would be to improve his record keeping by giving him a handheld device with which he could keep track of various details of his day including diet and environmental factors. We will be getting him a device but haven't decided on Pal...

What is a symbol table?

Can someone describe what a symbol table is in a C and C++ application? ...

char[] to hex string exercise

Below is my current char* to hex string function. I wrote it as an exercise in bit manipulation. It takes ~7ms on a AMD Athlon MP 2800+ to hexify a 10 million byte array. Is there any trick or other way that I am missing? How can I make this faster? Compiled with -O3 in g++ static const char _hex2asciiU_value[256][2] = { {'0','0'...

Why does a C/C++ program often have optimization turned off in debug mode?

In most C or C++ environments, there is a "debug" mode and a "release" mode compilation. Looking at the difference between the two, you find that the debug mode adds the debug symbols (often the -g option on lots of compilers) but it also disables most optimizations. In "release" mode, you usually have all sorts of optimizations turned o...

Have you used any of the C++ interpreters (not compilers)?

I am curious if anyone have used UnderC, Cint, and Ch (or any other C++ interpreter) and could share their experience. Thanks everyone for your valuable input. /Allan ...

C++: how to get fprintf results as a std::string w/o sprintf

I am working with an open-source UNIX tool that is implemented in C++, and I need to change some code to get it to do what I want. I would like to make the smallest possible change in hopes of getting my patch accepted upstream. Solutions that are implementable in standard C++ and do not create more external dependencies are preferred. ...

Get the current mouse coordinates

I have an iMac, and I want to be able to turn off the monitor when I go to sleep,. Alas, the iMac has no switch for this. I do not want to put the iMac into sleep mode, i want to write a "expose" like application or service, which when the mouse is put into the upper left hand corner of my screen, the display will sleep. Likewise, if ...

how to detect if I'm compiling code under visual studio 8?

Is there any way to know if I'm compiling under Microsoft Visual Studio 2008 ? ...

What is the best source to learn C++?

What is the best source to learn C++ for a C programmer. ...

Setting Excel Number Format via xlcFormatNumber in an xll

I'm trying to set the number format of a cell but the call to xlcFormatNumber fails leaving the cell number format as "General". I can successfully set the value of the cell using xlSet. XLOPER xRet; XLOPER xRef; //try to set the format of cell A1 xRef.xltype = xltypeSRef; xRef.val.sref.count = 1; xRef.val.sref.ref.rwFirst = 0; xRef.v...

What is the VTable Layout and VTable Pointer Location in C++ Objects in GCC 3.x and 4.x?

I am looking for details of the VTable structure, order and contents, and the location of the vtable pointers within objects. Ideally, this will cover single inheritance, multiple inheritance, and virtual inheritance. References to external documentation would also be appreciated Documentation of GCC 4.0x class layout is here and the...

deleting a buffer through a different type of pointer?

Say I have the following C++: char *p = new char[cb]; SOME_STRUCT *pSS = (SOME_STRUCT *)p; delete pSS; Is this safe according to the C++ standard? Do I need to cast back to a char* and then use delete[]? I know it'll work in most C++ compilers, because it's plain-ordinary-data, with no destructors. Is it guaranteed to be safe? ...

What use is multiple indirection in C++?

Under what circumstances might you want to use multiple indirection (that is, a chain of pointers as in **foo) in C++? ...