strcpy

Non-platform specific questions.

strcpy

Postby jazz_e_bob » Mon Jul 18, 2005 11:37 am

This code crashes GE

Code: Select all
char *actorName;

strcpy ( actorName, enemy.name );

strcpy (debugText.text, actorName);


I don't understand why... :(
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby jazz_e_bob » Mon Jul 18, 2005 11:56 am

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 "".
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby BeyondtheTech » Mon Jul 18, 2005 5:31 pm

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.
User avatar
BeyondtheTech
 
Posts: 270
Joined: Wed Mar 30, 2005 6:34 am
Location: Edison, NJ
Score: 4 Give a positive score

Postby makslane » Mon Jul 18, 2005 9:28 pm

Is a crash when use unitialized vars.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest