Gamestudio Links
Zorro Links
Newest Posts
Lapsa's very own thread
by Lapsa. 06/26/24 12:45
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Lapsa), 1,339 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 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 | chip programmers | 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