c++

Find address of variables in main?

Hi all, Recently while surfing some C++ blogs, I came across a small C teaser program in one of them. #include<stdio.h> int find_addr() { /*fill your code here*/ } int main() { int i,j; clrscr(); find_addr(); return 0; } The question is to find the address of variables i & j without touching the main function. I haven't been able t...

Math question in regards to functions in the form (1) / ( b ^ c )

I've found functions which follow the pattern of 1 / bc produce nice curves which can be coupled with interpolation functions really nicely. The way I use the function is by treating 'c' as the changing value, i.e. the interpolation value between 0 and 1, while varying b for 'sharpness'. I use it to work out an interpolation value betwe...

Using wmemset in c++

While using wmemset api (http://msdn.microsoft.com/en-us/library/1fdeehz6(VS.80).aspx) for the count parameter should I have to multiply the length of the target string by 2 and provide or will wmemset will itself take care of the conversion? ...

Good websites containing C++ puzzles/teasers?

Hi all, While there are good sites having interesting programming puzzles like mentioned in this SO post. But are there any specific to C/C++? ...

Using a STL container to store Treeview data

i'm looking for a C++ STL container class to keep the treeview parent/child node strings but when a node is deleted from tree control, do i have iterate through all the container class elements to find that selected one and then delete it? what's the best to keep the data updated in container? ...

Vim modules for navigating C++ code base?

Besides ctags / cscope, what are good vim plugins for navigating C++ code base? Ideally, when my cursor is on a variable name, I would like to be able to know: what is the class of this variable, what functions can I call on this varaible, jump to the class of this varaible ... and do this across multiple namespaces. What tools do yo...

Using templates to make items of varying length stay on stack?

The situation is that I have an array of items, and the items have an array inside. However, I want to make the array inside of variable length at declaration time, yet resizable at compile time. So I would want something like: class2<16>[] = new class2<16>[2048*1024]; Or whatever. Hopefully you get the idea. Obviously making it hav...

Converting System::String to Const Char *

I am using Visual C++ 2008's GUI creator to make a user interface. When a button is clicked, the following function is called. The content is supposed to create a file and name the file after the contents of the textbox "Textbox' with '.txt' at the end. However, that leads me to a conversion error. Here is the code: private: System::Vo...

How to insert data into a TdxMemData in Borland Builder

I'm struggling to insert data into a TdxMemData which is linked to a grid by a TDataSourse. The MemData -called PurchaseData- has 3 columns: Date (date), Place (string) and Value (currency). I have a button that does the following: PurchaseData->Insert(); PurchaseData->FieldByName("Date")->Value = TDateTime::CurrentDate().DateString(); ...

C++ I/O with Python

I am writing a module in Python which runs a C++ Program using subprocess module. Once I get the output from C++, I need to store the that in Python List . How do I do that ? ...

Treeview selected item index

is there anyway to get the index of selected tree view node or do they even have one? ...

Can I prevent object assignment?

I want to ensure that the following type of call is illegal: MyClass me; MyClass you; me = you; // how to make this illegal? Is it possible? ...

My wxFrame has a small thin 1 px border around it even though I asked for no border. Why?

Using wxwidgets. I want a window without a border. I pass the follwoing flags to the frame wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP but it still draws a black outline 1 px wide around the window. Is this a bug or something? ...

Configure .NET-Based Components for Registration-Free Activation

I've been trying to get a registration-free .NET based COM DLL to work, but without success. In Visual Studio 2008 I added a new C# class library. I enabled the 'make assembly COM-visible' and 'register for COM interop' options. I added a public interface and class with some functions. I added a manifest dependency to my C++ client app...

Nested anonymous namespace?

When using an anonymous namespace are there any issues if it is nested within another namespace? For example, is there any real difference between Foo1.cpp and Foo2.cpp in the following code: // Foo.h namespace Foo { void fooFunc(); } // Foo1.cpp namespace Foo { namespace { void privateFunction() { ...

Adapting OpenGL render context on remote desktop connection attempt

We have an application which uses an OpenGL render context in a subwindow to display a large bitmap. However, when a user remotely connects to a box running this app, the openGL display stops working, most likely due to the reduced texture resolution. While we can detect the remote desktop connection starting/ending using WTS_REMOTE_CO...

referenced argument to a function with default value in C++

Possible Duplicate: Default value to a parameter while passing by reference in C++ Is it possible to do something like this: // definition bool MyFun(int nMyInt, char* szMyChar, double& nMyReferencedDouble = 0.0); Then the function can be called either like this: MyFun(nMyInt, szMyChar, nMyReferencedDouble); or like this: ...

Editing PDF with XPDF (or with something else)

Hello All, I would like to ask if it is possible to edit PDF files using the xpdf library and if yes how? I guess this is possible but i could not find any tutorial nor documentation for xpdf so i have realy no idea :( . I'm also open for using another library if any other has support for pdf editing. My only requirement for such librar...

Get data from an external application's screen

Is it possible to get data (such a text or numbers) from an application? For example when one's running an application the screen displays some text, images and numbers, would it be possible to code an automated procedure that would read that data (for the sake of saving it to an external file)? ...

C++: Printing ASCII Heart and Diamonds With Platform Independent

I'm developing a card playing game and would like to print out the symbol for hearts, diamonds, spades and clubs. My target platform will be Linux. In Windows, I know how to print out these symbols. For example, to print out a heart (in ASCII) I wrote... // in Windows, print a ASCII Heart #include <iostream> using std::cout; using ...