c++

Console App Whereabouts c++

How would you set the initial position of a Console App on your Screen? ...

How to debug properly and find causes for crashes?

I dont know what to do anymore... its hopeless. I'm getting tired of guessing whats causing the crashes. Recently i noticed some opengl calls crashes programs randomly on some gfx cards. so i am getting really paranoid what can cause crashes now. The bad thing on this crash is that it crashes only after a long time of using the program, ...

C++ code parser/processor library

is there any library that parse a source code of C++ to produce lets say, call graph, class inheritance tree, flow control, class member list or anything as a ready to use graph or structure in code (not in diagram image). to make it more clear, suppose to generate call graph image, there will be a process like this: ` C++ source -> ...

How to change the default behavior of overwriting when GCC -fstack-protector-all is set?

I would like to use the GCC -fstack-protector-all option on release mode. The main issue is that when there is an override a core is built. I would like to plug something that will just dump the stack and let the program continue. Is there a way to do that? ...

C++ for small, individual projects (i.e. hobby programming)

I recently started C++. I am using PHP right now and decided to take a look at C++. Web programming had me working with a couple of languages, with a couple of people. I wanted to do programming where I only had to bother with one language and create small utility apps (mostly not web-based). I wanted a compiled, strongly-type language w...

c++ Sorting a vector based on values of other vector, or what's faster?

Hi, There are a couple of other posts about sorting a vector A based on values in another vector B. Most of the other answers tell to create a struct or a class to combine the values into one object and use std::sort. Though I'm curious about the performance of such solutions as I need to optimize code which implements bubble sort to ...

How to add value to second column using wxListCtrl in wxWidgets (C++ code)??

I've following code: int column_width = 100; long indx1 = alist->InsertColumn(0, L"User Name", wxLIST_FORMAT_LEFT, column_width); long indx2 = alist->InsertColumn(1, L"User Id", wxLIST_FORMAT_LEFT, column_width); long itemIndex1 = alist->InsertItem(indx1, L"John Smith", -1); alist->SetItem(indx1, 1, L"jsmith"); I expect to see two ...

how to do trig functions to data in Windows textboxes

must you convert from strings to double? if so. how? Are there functions for trig that will accept textbox string data as is? Is there a way to pull the data from the textbox as a numeric value, not as a string? ...

How can I find if an arbitrary process is running under wow64?

I need a tool which will discover whether an arbitrary process is running in x86 or x64 mode on a machine. I need to do this programatically from C++, based on a process ID. There has to be some way to do this (as you can clearly see it from the task manager). Does anyone know of a windows api that will tell you, given a process ID, w...

Compile JavaScript to Native Code with V8

Is it really possible, with Google's V8 Engine, to compile JavaScript into Native Code, save it as a binary file, and execute it whenever I want through my software envorinment, on any machine? ...

How do you hook a C++ compiled dll function to a sql database?

I want to do something like: lastName SIMILARTO(lastName, 'Schwarseneger', 2) where lastName is the field in the database, 'Schwarseneger' is the value that lastName field is being compared to and 2 is the maximum number of characters (edit distance) that can differ between the lastName field, and the entered value. I can implement the...

how can we avoid allocation done by Marshal::StringToHGlobalAnsi?

my wrapper from managed to unmanaged is handling a lot of data and this function Marshal::StringToHGlobalAnsi would call new for each of them, which is a big hit for me. So my question is : can I allocate a chunk of unmanaged memory and use it to convert the managed data types to unmanaged by hand. ...

How would I instruct extconf.rb to use additional g++ optimization flags, and which are advisable?

I'm using Rice to write a C++ extension for a Ruby gem. The extension is in the form of a shared object (.so) file. This requires 'mkmf-rice' instead of 'mkmf', but the two (AFAIK) are pretty similar. By default, the compiler uses the flags -g -O2. Personally, I find this kind of silly, since it's hard to debug with any optimization en...

C++ Lock-Free templated ObjectPool

do they exist ? *added to clarify: is there any usable library that implement lock-free (which is threadsafe and might be implement spinlock or other lightweight synchronization) ObjectPool ( http://en.wikipedia.org/wiki/Object_pool_pattern ) written in C++ language using template? ...

How do I make C++/wxWidgets code accessible to a wxPython app?

I have a code library which is written in C++ and makes extensive use of the wxWidgets library. I'm now trying to wrap my library (currently using SWIG) so that it's callable from wxPython, but I've hit a wall: ------ Build started: Project: MyLibLib, Configuration: Release_SWIG_OutputForBin Win32 ------ Performing Custom Build Step In ...

Real World strtod(); for use with WINAPI textbox.

ResultBox1->Text = (sin(TextBox1->Text)) * TextBox2->Text That is what i would like to work, but im dealing with Strings I cant seem to convert the strings, do the trig, and convert back to string for displaying properly... anyone with an example? ...

What do I name this class whose sole purpose is to report failure?

In our system, we have a number of classes whose construction must happen asynchronously. We wrap the construction process in another class that derives from an IConstructor class: class IConstructor { public: virtual void Update() = 0; virtual Status GetStatus() = 0; virtual int GetLastError() = 0; }; Ther...

When did C++ get nested classes?

Somehow I never noticed until today that C++ supports nested classes. This surprised me because when I was learning C++ back in the '90s, I specifically remember nested classes being something that Object Pascal and Java had, but which C++ did not. I asked an old programmer friend about it and he concurred that he recalls C++ not havin...

debug error : max must have union class struct types

this is my code: #include <iostream> using namespace std; class Sp { private : int a; int b; public: Sp(int x = 0,int y = 0) : a(x), b(y) { }; int max(int x,int y); }; int Sp::max(int a,int b) { return (a > b ? a : b); }; int main() { int q,q1; cin >> q >>q1; Sp *mm = new Sp(q,q1); cout << mm...

understanding the anatomy of file formats and image formats

I am trying to do some research on file formats especially image formats. Information such as header layouts for particular types of image formats and how to parse them using C++. If anyone can point me in the right direction of some good tutorials or books. that would be helpful. thanks [edit] If there are any resources on the general ...