c++

Embedding Python in C++

Adding python scripting capabilities to your code is an interesting thing to do, it can help you enhance an application without as much hard work. This is just an example on how to use code from memory as part of your program.


// Embedded Py.cpp
//

#include "stdafx.h"
#include
#undef _DEBUG /* Link with python24.lib and not python24_d.lib */
#include

using namespace std;

Tags:

Playing with templates

Dumb strokes of C++ templates while bored generated this templated queue.


#define QueueSize 5

template
class Queue
{

public:
Queue() : head(NULL), tail(-1) { for (int i=0; i < QueueSize; queue[i++]=NULL); }
void insert(T in);
bool isEmpty() { return ( queue[head] == NULL ) ? true : false; }
bool isFull() { return (head == tail && queue[head] != NULL) ? true : false; }
T remove();
void showContents();

private:
T queue[QueueSize];
int head, tail;

Tags:

Audio Player DLL

Well this project involves a lot of things that definitely are
entertaining. It started as a Audio Playing DLL. Vague? You bet.
Anyway, this DLL is nothing more than an MP3 player or was. I started
writing and got more excited everytime and eventually I decided to make
it compatible with XPCOM, and use it to play audio through mozilla.
I actually wrote that piece of code and its stashed somewhere!

Tags:

Subscribe to RSS - c++