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
3 registered members (AndrewAMD, Grant, Neb), 908 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
str_cpy with index dont work #342986
10/02/10 19:03
10/02/10 19:03
Joined: Oct 2010
Posts: 8
A
AshHF Offline OP
Newbie
AshHF  Offline OP
Newbie
A

Joined: Oct 2010
Posts: 8
hi, the following code don't work: (A8)
Code:
STRING* test[1];

int main(){
	str_cpy(test[0],"test");
}



Message: Error 1515: Invalid arguments in main

I think it's a bug (or a missing feature) or I do something wrong. But what?
Thanks for help.

Last edited by AshHF; 10/02/10 19:05.
Re: str_cpy with index dont work [Re: AshHF] #342988
10/02/10 19:10
10/02/10 19:10
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 987
Budapest
Try this:
Code:
STRING* test[1];

int main(){
    test[0] = str_create("");
    str_cpy(test[0],"test");
}



Re: str_cpy with index dont work [Re: Aku_Aku] #342990
10/02/10 19:49
10/02/10 19:49
Joined: Oct 2010
Posts: 8
A
AshHF Offline OP
Newbie
AshHF  Offline OP
Newbie
A

Joined: Oct 2010
Posts: 8
oh okay i always only did:
Code:
test[0]="";


(i've forgot it above)
but if i use str_create i have to delete the content.
for example:
Code:
int main(){
    test[0] = str_create("");
    str_cpy(test[0],"test");
    test[0]="";
}


will leak memory. thats ugly.. i want to use str_cpy with arrays in the same way like strings.
Code:
test[0]="";
str_cpy(test[0],"test");


that should work! but it don't...



Last edited by AshHF; 10/02/10 19:53.
Re: str_cpy with index dont work [Re: AshHF] #342992
10/02/10 20:03
10/02/10 20:03
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 987
Budapest
Quote:
will leak memory. thats ugly..

That is right, if you don't use the ptr_remove... See the manual for it.

Re: str_cpy with index dont work [Re: Aku_Aku] #343169
10/04/10 07:17
10/04/10 07:17
Joined: Dec 2009
Posts: 128
China
frankjiang Offline
Member
frankjiang  Offline
Member

Joined: Dec 2009
Posts: 128
China
but if i use str_create i have to delete the content.
for example:

STRING* teststr = "";

str_cpy(teststr ,"this is test string");
?
who can tell me why used this code.
why do that like this code?

---------------------------------------------------------------
and then i sugesst you: don`t be used STRING array
you can used STRING likes "string1,string2,string3,",i Think if you uesed STRING array to write will be eat much more computer monroy.

on your project, just used STRING Var ,don`t used STRING Array.guys.

this is juet my idea,friends.

Last edited by frankjiang; 10/04/10 07:28.

development 3d game is interesting!

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