Page 1 of 1

strcpy

PostPosted: Mon Jul 18, 2005 11:37 am
by jazz_e_bob
This code crashes GE

Code: Select all
char *actorName;

strcpy ( actorName, enemy.name );

strcpy (debugText.text, actorName);


I don't understand why... :(

PostPosted: Mon Jul 18, 2005 11:56 am
by jazz_e_bob
It's OK - I worked it out:

char *actorName;

should be

char actorName[256] = "";



This creates a 256 character string called actorName and sets the initial value to "".

PostPosted: Mon Jul 18, 2005 5:31 pm
by BeyondtheTech
What version of Game Editor Pro are you using? I believe he resolved this error in 1.3.0. I was having consistent crashes with all my strcpy and strcat commands until he found the bug.

PostPosted: Mon Jul 18, 2005 9:28 pm
by makslane
Is a crash when use unitialized vars.