Can anyone help us out in this dept, everytime I go through my program when it terminates I get the famous windows:

"main.exe has encountered a problem and needs to close. We are sorry for the inconvencience ........

Debug,

Send Error Report,

Don't Send

Yep that one... Can anyone offer pointers in what could be wrong? I've freed up all the dynamic memory allocated yet it still does it.


Ok I missed one in main() !!! stupid OOP lol.... I get a new error now saying:


Debug Error!

Program ... ents and settings // directory...

DAMAGE : After normal block #47 at 0x00491EF0

Press Retry to debug the application

your probably overstepping the bounds of an array somewhere. Other than that its hard to say without seeing code. we are not psychics.

Heres the code....its driving me nuts!

Replace strcpy(buffer, holdingArray[1]) with buffer=strdup(holdingArray[1]). Or give buffer enough space (at declaration) to hold the biggest guess word. ;)

Your program needs some tunning. Remember to randomize the guess words and don't count successes as failed attempts!

Replace strcpy(buffer, holdingArray[1]) with buffer=strdup(holdingArray[1]). Or give buffer enough space (at declaration) to hold the biggest guess word. ;)

Your program needs some tunning. Remember to randomize the guess words and don't count successes as failed attempts!

the only reason the random isnt in use is so that I can debug it.....its not a memory allocation problem other wise it would fail straight away...also note that above strcpy is a string lenght function along with that in the constructor, therefore only allocation just enough bytes of memory rather than wastage!!

>Replace strcpy(buffer, holdingArray[1]) with buffer=strdup(holdingArray[1]).
strdup isn't a standard function, so you shouldn't expect it to exist since there was no mention of which compiler is used. Fortunately, it's easy to write:

char *copystr ( const char *s )
{
  char *rs = new char[strlen ( s ) + 1];

  if ( rs != NULL )
    strcpy ( rs, s );

  return rs;
}

>Replace strcpy(buffer, holdingArray[1]) with buffer=strdup(holdingArray[1]).
strdup isn't a standard function, so you shouldn't expect it to exist since there was no mention of which compiler is used. Fortunately, it's easy to write:

char *copystr ( const char *s )
{
  char *rs = new char[strlen ( s ) + 1];

  if ( rs != NULL )
    strcpy ( rs, s );

  return rs;
}

heh thanks, but this doesnt help does it?

No, but Narue showed the key. Sorry. I did not see the your new char() statement. Use new char[], BTW. It was a memory allocation problem, in the end.

>but this doesnt help does it?
If all you're looking for is the answer to your immediate question, it doesn't help. But if you want to become a better programmer, it helps a great deal. But some people just want the answers...

>but this doesnt help does it?
If all you're looking for is the answer to your immediate question, it doesn't help. But if you want to become a better programmer, it helps a great deal. But some people just want the answers...

I try not to ask ask and ask..... and take the answer.... but when something isnt clear.... as to missing '[]' makes me feel a little dum! Never mind one step to becomming a better programmer! Cheers for all your help though...I'm over one milestone in my c++ conquest!

This question has already been answered. Start a new discussion instead.