c++

How to create a BMP file from raw byte[] in Java

I have a C++ application which communicates with a camera and fetches raw image-data. I then have a Byte[] in C++, which i want to send to Java with JNI. However, i need to convert the raw Byte[] to an real file format(.bmp was my first choice). I can easily do this if i write it from C++ to an file on the hard-drive, using BITMAPFILEI...

Right side Explorer context menu (IID_IContextMenu?)

One of my applications has a Windows Explorer like file list control. When the user right clicks on a file I can successfully show the Explorer context menu (with some extra options of my own). However if the user right clicks on the list control itself (no items selected), then I'm unable to show the 'correct' context menu. I'd like to ...

nested struct with array

Please, help me to create a nested struct with an array. How do I fix this code? class CMain { public: CMain(); ~CMain(); private: struct { CCheckSum() : BufferSize(500) {memset(Buffer, 0, BufferSize);} const int BufferSize; char Buffer[BufferSize]; }Sm...

How to find a dll is present in the system or not or how to find whether SQLSERVER2008 installed or not using c++

Hi My intension is to find the "Microsoft.SqlServer.Management.Sdk.Sfc.dll" is present in the system or not. And generally this will be came up with sqlserver2008 installation usually it is available in C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies or can u provide me atleast a way to find whther SQLSERVER2008 installed or...

Which one to use when static_cast and reinterpret_cast have the same effect?

Often, especially in Win32 programming it is required to cast from one opaque type to another. For example: HFONT font = cast_here<HFONT>( ::GetStockObject( SYSTEM_FONT ) ); Both static_cast and reinterpret_cast are applicable here and have exactly the same effect since HFONT is a pointer to a dummy struct specifically introduced for...

Fetching rows in a MySQL database table using MySQL C API and C++

Hello there, I'm confused when trying to fetch table rows in mysql using C++ with MySQL C API. I can do it easily in PHP, just because C++ is a strongly-typed language so that we also need to take care of the dirty process.. This is how I done it in PHP $data = array(); $i = 0; $query = mysql_query("SELECT * FROM `my_table`"); while(...

Write your own memory manager

Hi, I'd like to write my own memory manager. The target language is C++ and the goal of the memory manager is mainly to help debugging. It should detect double frees, memory overwrite and so on. And of course - I'd like to learn about memory management. Can someone give me a hint so resources where I can learn how to write such a memor...

Good book for learning native Visual C++?

I would like to create a few simple programs that don't have the huge .NET framework as a dependency. The obvious choice is C++ under Visual Studio. What's the best book for a programmer that has a reasonable familiarity with the C++ language but is a bit rusty on Win32 arcana? Also, what's the preferred jargon? "Native," "Win32," or "...

Refactoring C++ in Eclipse CDT

I've installed the Galileo release (Eclipse 3.5/CDT 5.1) in hopes of utilizing the better refactoring support mentioned in http://stackoverflow.com/questions/130913/what-is-the-state-of-c-refactor-support-in-eclipse However I do not see all the mentioned refactoring options listed. I don't see any plug-ins related to refactoring on ...

Is it safe to serialize a raw boost::variant?

boost::variant claims that it is a value type. Does this mean that it's safe to simply write out the raw representation of a boost::variant and load it back later, as long as it only contains POD types? Assume that it will be reloaded by code compiled by the same compiler, and same version of boost, on the same architecture. Also, (prob...

Does SQL Server Compact Edition depend on the .net framework?

My company is looking at using SQL Server Compact Edition 3.5 as a datastore for a few programs that have been developed over the last several years. Most of these programs are were written in C++ and are installed on some older machines with Windows 2000, XP, or Vista installed. Does SQL Server Compact Edition 3.5 depend on the .net fra...

Is there a Java equivalent or methodology for the typedef keyword in C++?

Coming from a C and C++ background, I found judicious use of typedef to be incredibly helpful. Do you know of a way to achieve similar functionality in Java, whether that be a Java mechanism, pattern, or some other effective way you have used? Thanks, -bn ...

Avoiding repeated replacements in the C pre-processor

I've been hacking on a program that itself creates simulation programs in C. The user specifies the top-level design, and this programs inserts small C-fragments and a helluvalot glue-code (a few thousand lines). It does local naming by #defines: #define x local_x #define vx local_vx /* user code that uses x, ex */ vx = x / 2 #undef vx...

compiling "standard" C++ in visual studio (non .net)

(This is a probably a very beginner question and I may be missing something obvious) I've just moved from my mac back to windows, and I'm trying to get set up with C++. I have visual studio 2008 C++: how do I compile "normal" non .net/clr C++? I want a command line application, and the only project that seemed fit was "CLR console appli...

Integer storage - Hexadecimal/Octal

I understand that integers are stored in binary notation, but I was wondering how this affects the reading of them - for example: Assuming cin.unsetf(ios::dec); cin.unsetf(ios::hex); and cin.unsetf(ios::oct); the user inputs 0x43 0123 65 which are stored as integers. Now assume that the program wants to recognize these values as ...

convert a char* to std::string

I need to use std::string to store data retrieved by fgets(). To do this I need to convert fgets() char* output into an std::string to store in an array. How can this be done? ...

How to interpret numbers correctly (hex, oct, dec)

I'm trying to write a program that takes input of - hexadecimals, octals, and decimals -, stores them in integer variables, and outputs them along with their conversion to decimal form. For example: User inputs: 0x43, 0123, 65 Program outputs: 0x43 hexadecimal converts to 67 decimal 0123 octal converts to 83 decimal 65 decimal convert...

How to keep items sorted based on dynamic attribute?

I'm using an STL std::multiset<> as a sorted list of pointers. The sort order is determined by a property of the items being pointed to, something along the lines of this simplified example: struct A { int x; }; bool CompareAPointers(const A* lhs, const A* rhs) { return lhs->x < rhs->x; } std::multiset<A*, CompareAPointers> sorted_...

Does anyone know how to use MS SOAP toolkit?

I know that the Microsoft SOAP toolkit has been deprecated for a while now (.NET has all this stuff built in) but I was wondering in anyone has a quick bit of info on setting up a simple app that uses it. I was referred to http://www.devarticles.com/c/a/Cplusplus/Building-A-SOAP-Client-With-Visual-C-plus/ but the service in the example ...

Desktop Version of Google's Annotated Time Line Component?

I've been using Google's Annotated Time Line Visualization component for the last couple of weeks and I love it! I've been able to make plots with about 10k points without much trouble. Do you know of a desktop component I could plug into my application that delivers the same WOW factor that Google's component does? I don't care what th...