I'm having a little problem here. Every time I run the code below, my program just crash.
void Wingcod::push(byte b)
{
stack[stackp] = b;
stackp++;
if(stackp >= stacks)
{
stacks += 16;
try
{
realloc(stack,stacks);
}catch(bad_alloc*)
{
cerr << "STACK OVERFLOW";
exit(1);
}
}
}
And stack, stackp and stacks is defined like this:
stacks = 8;
stackp = 0;
stack = new byte[stacks];
And byte is just a unsigned char.
std::vector<byte>that does exactly what you need.