Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 12,420 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Structs and digits #152661
09/08/07 01:53
09/08/07 01:53
Joined: Sep 2007
Posts: 14
X
xykynan Offline OP
Newbie
xykynan  Offline OP
Newbie
X

Joined: Sep 2007
Posts: 14
I'm relatively new to programming, so please bear with me if this is a dumb question.

I have the following code:


typedef struct
{
STRING* name;
} TEST;

TEST* junk =
{
name = "aaa";
}

PANEL* new =
{
layer = 1;
red = 100;
blue = 100;
green = 100;
size_x = 400;
size_y = 400;
flags = VISIBLE | LIGHT;
digits (10, 10, 4,*, 1, junk.name);
}

I was hoping it would print the string "aaa", but instead it just gave me numbers.

Thanks in advance.

Re: Structs and digits [Re: xykynan] #152662
09/08/07 06:54
09/08/07 06:54
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Yeah that code makes no much sense. The panel is ok but how you set up that "TEST*" struct looks very wrong.

You can define a string this way

STRING* name = "aaa";

or in the code, this way

junk.name = str_create("aaa");

but certainly not

TEST* junk =
{
name = "aaa";
}

because "aaa" is a char[] array and not a STRING.

Re: Structs and digits [Re: Tobias] #152663
09/08/07 11:50
09/08/07 11:50
Joined: Sep 2007
Posts: 14
X
xykynan Offline OP
Newbie
xykynan  Offline OP
Newbie
X

Joined: Sep 2007
Posts: 14
Thank you very much!


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1