c++

customizing assert macro

On Windows/c++, I want to customize the assert dialog box to ignore an assertion forever, so I can be more aggressive with assertions. I understand how hard it is to write a correct assert macro, and do not wish to do this, just hook the dialog code. Is there an easy way (or concise hack) to do this? article on assert macro dangers (g...

Use domain-specific-language files inside C++ project

Hi I am developping a DSL with its own graphical editor. Such files have a .own extension. I also have a small tool that compiles .own files into .h files. X.own --> X.h and X/*.h I have written a simple .rules file to launch the generation. My problem is the following : Most of my source files include X.h, but a change in X.own does...

Why am I able to read char[2] but not char[1]?

I am able to read char into char[2] in OCI C++ code, but I am not able to read to char[1]? Does anyone have any idea why? (oracle data type is char(1)) ...

C/C++ best way to send a number of bytes to stdout

Profiling my program and the function print is taking a lot of time to perform. How can I send "raw" byte output directly to stdout instead of using fwrite, and making it faster (need to send all 9bytes in the print() at the same time to the stdout) ? void print(){ unsigned char temp[9]; temp[0] = matrix[0][0]; temp[1] = ma...

using C++ boost regex

Hi, I am not an expert in boost, though I have used ublas extensively. Recently, my supervisor asked me to build boost regex for the gcc platform. My question is: Why can't I use the regex as it is, like ublas? Please give detailed answer. ...

XCode automatically deactivating breakpoints

I'm using xcode in C++. I'm trying to debug my project, but at random intervals, it seems to ignore my breakpoints. There are three things that it does: 1) Sometimes, when I run, it automatically switches to "de-activate break points" mode. (the relevant button goes light and says "Activate") 2) Sometimes when I run, ALL of my breakpoi...

Change Properties.settings for a .net deployed application

Hi All, I have two .net applications, these applications want to talk to each other, I made a setting in the first project as follows [CompilerGeneratedAttribute()] [GeneratedCodeAttribute("SettingsSingleFileGenerator", "9.0.0.0")] public sealed partial class Settings :ApplicationSettingsBase { [UserScopedSettingAttribute()]...

C/C++ AQtime profiler questions

I need to profile my console program with AQ. It is in one big file (for optimizations purposes). void function1(); void function2() // etc more declarations int main{ //alot of loops, and function uses function1(); function1(); } Profiling on "Elapsed time" default profile just gives me that main is using 100% and that i...

Third party dll is missing, what should I do while waiting?

I am working on a legacy C++ project and missing a third party dll. I was told that the dll will be available in two weeks. The work that I need to perform is pure UI. I don't really need the dll. However, the application won't run without the dll. Should I comment out all the places that the dll get called or create a place holder dll, ...

IR Port API example C#/C++

Hi there, I'm looking for any code sample using the windows IR API. I want to make a little application, to control a windows based PC from an infrared remote control sending commands to a IR Port, and I'm having some some troubles in finding documentation. Do you know any opensource code, tutorial, or something to learn about this I...

How do I make a pointer to a multidimensional array which has an unknown size?

how do I make a pointer to a multidimensional array, which have a unknown size? I've tried this: int **triangles; triangles = new int[numTriangles][3]; But i get this error: cannot convert 'int (*)[3]' to 'int**' in assignment ...

Using Iterator parsing with Boost::Spirit Grammars

When I attempt to use the iterator form of parsing for a Spirit grammar I get a argument passing conversion error from the iterator type to const char*. How do I fix this? There are some restrictions. I'm using an iterator adapter on large inputs, so it is not feasible for me to convert to a C style string. Here is sample code demons...

Returning the greatest key strictly less than the given key in a C++ Map

Is there a way the C++ STL Maps support this, since lower_bound and upper_bound on maps strictly return the value greater than the passed value. Lower key Use case I have a map with times as keys in a sorted manner so in a MAP time t1 = value1 time t2 = value2 time t2.5 = value3 In this case if I pass to this MAP t2.3 then it s...

C++ Passing a dynamicly allocated 2D array by reference

This question builds off of a previously asked question: Pass by reference multidimensional array with known size I have been trying to figure out how to get my functions to play nicely with 2d array references. A simplified version of my code is: unsigned int ** initialize_BMP_array(int height, int width) { unsigned in...

Handle leaking in WinAPI CreateFile?

CreateFile allocates 2(!!) handles and CloseHandle closes only one handle when trying to get the low-level access to cd-rom device. OS Windows XP SP3, 5 of 7 tested computers works the same. When trying to access hdd drive letter CreateFiles works OK and allocate only one handle. Here is the sample code: HANDLE m_driveHandle = Create...

Using stdio to read and sort piped data in Linux

As the title says, I need to write a small program to read data from standard input, sort it, and send it to standard output. The program should take 1 argument that tells it how long is one record (in bytes). Here's how I test it: printf 'D\x00C\x00\x00B\x00A' | ./binsort 2 | od -c The above should output something like: 0000000 \0...

calling C# from c++ com add-in

Hi, I have a COM add-in written in C++ (not C++ / CLI). I want to call a C# library objects/methods from this C++ com library. I guess the CCW comes into picture here, which i am currently reading about. Are there any quick pointers to this stuff from your experience? Also, i have a method in my Com add-in that i would like my C# lib...

Do I need to create an interface for every self-created class I use in XPCOM?

Hi, I'm a noob to XPCOM development. In the course of writing XPCOM code in C++, I need to create addtional classes for use inside my XPCOM component. Do I need to create another XPCOM component for such classes? Can't I just add the new class in the header file? ...

Linking to a static lib that links to a static lib

I have a (managed/unmanaged C++) winforms app that links to a static library. That library links to another static library. When I do a Rebuild on the Winforms project, Visual Studio 2005 attempts to rebuild the references static library, but does not rebuild deeper than one level. This causes me to have to manually rebuild the leaf proj...

In C++ does std::multiset keep a stable sorting order?

Suppose I have two items, a and b, that compare the same. So a < b is false, and b < a is false. If these items are inserted into a std::multiset (or std::multimap) as keys, do I have any guarantees of their final sorted order? I've checked a couple of references, but I couldn't find the answer. I'm tempted to think that there are no gu...