Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Quad, AndrewAMD), 1,007 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
sending a struct #291853
09/28/09 14:23
09/28/09 14:23
Joined: Jul 2005
Posts: 3
Deutschland
J
Janemann Offline OP
Guest
Janemann  Offline OP
Guest
J

Joined: Jul 2005
Posts: 3
Deutschland
Hey,
i'm having trouble sending a whole struct with send_var(_player). it contains a STRING* pointer wich is losing its value.

the struct kinda looks like this:

typedef struct {
var id;
STRING* name;
var x;
var y;
var z;
} PL;

PL _player;

but by sending every element seperately like:

send_string(_player.name);
send_var(_player.id);
//...

the engine cashes. It only works for the first element of the struct.

can anybody help me?

Re: sending a struct [Re: Janemann] #291863
09/28/09 15:11
09/28/09 15:11
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
GorNaKosh Offline
Junior Member
GorNaKosh  Offline
Junior Member

Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
Hm I think the problem could be that if you initialize the struct there are reserved 4bytes for a String-pointer only. Try with
Code:
typedef struct {
STRING name;
//...
} PL;

//or better to controle/optimize the struct size
typedef struct {
char name[20];
//...
} PL;



hope it helps
Gor Na Kosh

Last edited by GorNaKosh; 09/28/09 15:55.
Re: sending a struct [Re: GorNaKosh] #291891
09/28/09 18:52
09/28/09 18:52
Joined: Jul 2005
Posts: 3
Deutschland
J
Janemann Offline OP
Guest
Janemann  Offline OP
Guest
J

Joined: Jul 2005
Posts: 3
Deutschland
thanks! im gonna give it a try. i'm glad to see c-style strings are supported in lite-c

Re: sending a struct [Re: Janemann] #291901
09/28/09 19:35
09/28/09 19:35
Joined: Jul 2005
Posts: 3
Deutschland
J
Janemann Offline OP
Guest
Janemann  Offline OP
Guest
J

Joined: Jul 2005
Posts: 3
Deutschland
jap, works laugh


Moderated by  HeelX, Spirit 

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