Gamestudio Links
Zorro Links
Newest Posts
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
contractUpdate() is filtering if >2 rows
by mistery. 11/09/26 12:06
New Zorro version 3.15
by jcl. 11/09/26 09:24
Removing outliers from files
by jcl. 11/04/26 10:30
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 9,630 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
diag_var with parameter 0 #277189
07/08/09 08:59
07/08/09 08:59
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi,

I use a code quite similiar to this:

Code:
for(i=0; i<4;i++) {
	diag_var("checking door: %3.0f", i);		
}



The output is:

checking door: %3.0f
checking door: 1
checking door: 2
checking door: 3

As you can see the result isn't correct with value 0.
I have the same problem in different codes.

Regards,
Pegamode.

Re: diag_var with parameter 0 [Re: pegamode] #277407
07/09/09 08:13
07/09/09 08:13
Joined: Jul 2000
Posts: 28,149
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,149
Frankfurt
We can not confirm this problem.

Re: diag_var with parameter 0 [Re: jcl] #277467
07/09/09 11:15
07/09/09 11:15
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
I couldn't reproduce this behaviour by directly calling diag_var, too.

But with this code the "error" occurs:

Code:
#include <default.c>
#include <acknex.h> // Pure Mode

void ediag(STRING* fctName, STRING* level, STRING* diagStr, var param) {	
	STRING* outputStr = str_create("");		
	if (fctName != NULL) {
		str_cat(outputStr, "[");
		str_cat(outputStr, fctName);
		str_cat(outputStr, "]: ");
	}
	str_cat(outputStr, diagStr);
	if (param == NULL) {
		diag(outputStr);
	} else {
		diag_var(outputStr, param);
	}
}

void main() {
	diag("\n");
	STRING* fctName = "void main()";
	STRING* LEVEL_INFO = "INFO";
	int i;
	for(i=0; i < 5; i++) {
		ediag(fctName, LEVEL_INFO, "test: %3.0f\n", i);
	}
}



Can you identify an error in this code?

Regards,
Pegamode.

Re: diag_var with parameter 0 [Re: pegamode] #277553
07/09/09 15:38
07/09/09 15:38
Joined: Jul 2000
Posts: 28,149
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,149
Frankfurt
I'm passing this question to the community. - Please post only engine bugs to the bug forum. It's not right forum to ask for help with your code.

Re: diag_var with parameter 0 [Re: jcl] #277555
07/09/09 15:43
07/09/09 15:43
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Code:
if (param == NULL) {
		diag(outputStr);


This code makes no sense.
if you pass 0 as param, it will just output the string without using a parameter as NULL is defined to 0 by default.

But even if you fix this, you'll always have your %3.0f in the string, as it is always appended, regardless whether you actually want to print a value or not.

Re: diag_var with parameter 0 [Re: FBL] #277878
07/11/09 08:12
07/11/09 08:12
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
NULL = 0 ???

That's quite strange and should not be, shouldn't it?

NULL is NULL and 0 is 0.

Is this behaviour just for vars??? Could I get a difference if I use int or void* ???

Regards,
Pegamode


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