c++

Super basic declaring new templated class objects question

Hello all. I know this is probably a first year question, but I'm having some problems with templates and I haven't found a suitable answer yet. I'm trying to instantiate a new templated class like so: TreeNode <T>newLeft = new TreeNode(root->data[0]); Which is refering to a constructor which looks like: template <class T> //paramert...

Linking with .so files (webkit)

Hi, I'm trying to create a program that uses some of the code from WebKit/GTK+. Specifically, I want to load a string, use WebKit's parser to construct a DOM tree and then iterate over that tree. I'm trying to use a class called HTMLDocument. WebKit/GTK+ doesn't expose this as part of its API and I'm running into some trouble linking ...

help overloading << and >> to display two values

This may be a novice question, but I can't figure it out by inspecting the book I have. The class's constructor initializes two doubles, and I want the following code to output those two doubles with <<. Complex x( 3.3, 1.1 ); cout << "x: " << x; After this I need to overload >> to accept two doubles into these. This is my first ques...

What is the best language for sockets programming?

I'd like to develop software program that communicates between clients. What is the best programming language to do this? ...

Active Scripting on the server side

I am considering writing a NT service. The service will need scripting capabilities. Users can write some VBScript/JScript code and feed the server. I also want the script be able to debug in Microsoft Script Debugger. The service will behave in a similar way as IIS with classic ASP. It gets input from somewhere else. When it get inpu...

populating int array that is a member variable

Hi, I'm using C++ to create a tile map for a game. My problem is, I want to populate a multidimensional array of ints in the Map constructor, but it's not working properly. Here's my code in "Map.h" (irrelevant code has been removed). class Map { private: int mapArray[15][20]; }; And my code from Map.cpp Map::Map() { mapA...

Calling a Function From a String With the Function’s Name in C++

How can I call a C++ function from a string? Instead of doing this, call the method straight from string: void callfunction(const char* callthis, int []params) { if (callthis == "callA" { callA(); } else if (callthis == "callB") { callB(params[0], params[1]); } else if (callthis == "callC") { callC(params[0]...

Integrating Erlang with C++

What interfaces exist to tie Erlang with C++? ...

C++: How to Perform Deep Cloning of Generic Type

To keep the long story short, I am unable to use the container from the STL and boost library and have to create my own. My own generic container is coded in VC++6 and I need to know how to manually allocate memory for generic types before storing it in my own container. The generic types are all struct that can contain nested struct. ...

Visual Studio 2008 template containing both a C# and a C++/CLI project?

Hello everyone, I'm currently writing a Winamp plugin framework for C# (basically, a C# implementation of the Winamp API/SDK, as well as a barebones plugin template). Because C# libraries can't export DLL entry points, I'm using a C++/CLI wrapper which basically just loads the C# library. I'd like to create a Visual Studio template for ...

C stdlib .h's on C++ and malloc/realloc

I was really bothered by the inclusion of C stdlib functions on the global namespace and ended up writing things like ::snprintf or ::errno or struct ::stat, etc, to differentiate from some of my own functions in the enclosing namespace where those c stdlib functions were used. Then I discovered that there is a way to declare every C st...

C++: Compile Error for Template Assignment Operator Overloading

I keep getting the error "use of class template requires template argument list" when I compile the following code in VC++6. What is wrong with it? template <class T> class StdVector{ public: StdVector & operator=(const StdVector &v); }; template <typename T> StdVector & StdVector<T>::operator=(const StdVec...

C++ : Potential Issues with Custom Coded Generic Container?

I am unable to use the STL and boost library and I have to write my own container in C++. The following code compiles without error in VC++6. I have not actually tested the code but is concerned whether this generic container will work with both primitive and non primitive types (like class). Will there be any potential issues with the ...

Capture bitstream into string

I'll need to capture my bitstream into a string and keep concatenating the string. However, I'm not really sure how it's to be done. Any ideas? #include <bitset> #include <iostream> #include <string> using namespace std; int main () { int i; char data[30]; int int_arr[30]; printf("\nEnter the Data Bits to be transmitted :...

How to create a magnet link client (for ex for ThePiratBay)

How to create a magnet link downloader sharer using open source libs (C# if possible) ? What do I need: Open Source Libs/wrappers. Tutorials and blog articles on How to do it, about etc. ...

Designing a virtual machine with JIT

Hello, I'm developing a scripting language that compiles for its own virtual machine, a simple one that has instructions to work with some kind of data like points, vectors, floats and so on.. the memory cell is represented in this way: struct memory_cell { u32 id; u8 type; union { u8 b; /* boolean */ double f...

AND-ing shorts in c++

How would i write a piece of code that ANDs the first byte of a short, but not the second part? Eaxmple: I have a short called inputShort, and I want this short to delete all values in the second byte. So I want to AND this with a logic operator. Well, I tried, and I failed. so can someone give me an example how to do this ? My goal i...

Const, conversion, and generic array problem

I have a problem in these lines: const int* index = faceArray[f].vertices; const Vector3& A = vertexArray[index[0]]; const Vector3& B = vertexArray[index[1]]; const Vector3& C = vertexArray[index[2]]; faceNormal[f] = Vector3::Cross(B - A, C - A).Normalize(); When I try to compile, I get an error: error C2678: binary '[' : no operat...

SSL reverse proxy for legacy application binary transfers on sockets

Hello I'm struggling to find a reverse proxy http->https like for binary sockets. There is a Pound server which offers this kind of SSL tunneling but just for the http protocol. Basically I work on 4'th layer TCP/IP with binary data. Between flex/AIR client and c++ server. I can wrap sockets in C++ without problems, but this is a prob...

C/C++ Linked list

I'm trying to make linked list similar too the one here: http://stackoverflow.com/questions/982388/linked-list That is to have the "head", I called it first, inside another struct. However I found doing that change. Makes it hard to add values to the list_item struct. I have tried some few things to see if it works. It compiles, howeve...