1 registered members (1 invisible),
735
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
advideLong & script
#480671
06/25/20 17:07
06/25/20 17:07
|
Joined: May 2015
Posts: 390 Czech Republic
Grat
OP
Senior Member
|
OP
Senior Member
Joined: May 2015
Posts: 390
Czech Republic
|
Hi, I have one script where I generate rules
scritp gen.c
function run()
{
assetList("Assets4");
string cSymbol=strx(Asset,"/","");
Script = strf("AlfaEE_%s",cSymbol);
...
vL = adviseLong(PATTERN+FAST,0,
}
and in second - where I use rules from first (gen.c). But I cannot get, if second script use this rules or not
script second.c
function run()
{
assetList("Assets4");
string cSymbol=strx(Asset,"/","");
Script = strf("AlfaEE_%s",cSymbol);
I change name the script to: Script = "AlfaEE_error";but I dont see any error and script second.c runnign without problem. But no open any order.
Last edited by Grat; 06/25/20 17:16.
|
|
|
Re: advideLong & script
[Re: Grat]
#480674
06/26/20 13:21
06/26/20 13:21
|
Joined: Feb 2017
Posts: 1,725 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,725
Chicago
|
You didn't do what I said to do. You did not create a char buffer. Take a look at this code and its output: void main(void){
string a = strf("apple");
string b = a;
char c[20];
strcpy(c,a);
string d = c;
printf("\na1: %s",a);
printf("\nb1: %s",b);
printf("\nc1: %s",c);
printf("\nd1: %s",d);
int i;
for(i=0;i<100;i++){
strf("banana%d",i);
}
printf("\na2: %s",a);//undefined behavior (bad)
printf("\nb2: %s",b);//undefined behavior (bad)
printf("\nc2: %s",c);//defined behavior (good)
printf("\nd2: %s",d);//defined behavior (good)
}
/*output:
a1: apple
b1: apple
c1: apple
d1: apple
a2: banana99
b2: banana99
c2: apple
d2: apple
*/ Note that a and b were ruined, whereas c and d remained intact. By the way, strx() also returns temporary pointers, so you can expect similar problems.
|
|
|
|