In my continuing saga of reading a files' contents into a zorro script, I have come across a problem.
To recreate this you need to:
A: open notepad and type a few lines pressing return at the end of each line and then save the file in zorro's history folder. Give it a new of atestfile.txt
B: copy the following text into a new zorro script.

#define H1 (60/BarPeriod)

function run()
{
BarPeriod = 60;
TimeFrame = H1;
Lots=1;
Margin=0;
set(LOGFILE);
StartDate=20080102;
EndDate=20080131;
var acctbal;
if(is(INITRUN)){
string buff = file_content("History\\atestfile.txt");
printf("# \n %s80 \n", buff);
}

printf("# \n ALLDONE! \n");
}

Now save as atest.c and select EURUSD for the test currency and then run the script.
Now open in notepad the file \log\atest_EURUSDtest.log
you should get something like this:


BackTest: atest EUR/USD 2008
[1: Wed 02.01. 10:00] 1.46545
ALLDONE!

[2: Wed 02.01. 11:00] 1.46624
ALLDONE!

[3: Wed 02.01. 12:00] 1.46532
ALLDONE!
etc etc etc...IE No printing of the buff string.

now go back and comment out the if(is(INITRUN))
so it looks like this:
//if(is(INITRUN)){
string buff = file_content("History\\atestfile.txt");
printf("# \n %s80 \n", buff);
//}

saveit and run it again

Now you get something that looks like this:

BackTest: atest EUR/USD 2008
[1: Wed 02.01. 10:00] 1.46545
abcdef 1234

ghijkl 1234

mnopqw 1243

ertyui 1243

asdfgh 124

zxvcbn 43280

ALLDONE!

[2: Wed 02.01. 11:00] 1.46624
abcdef 1234

ghijkl 1234

mnopqw 1243

ertyui 1243

asdfgh 124

zxvcbn 43280

ALLDONE!

etc etc etc....
NOW it prints the buff string...

So now after all of this.... I am stupid, because I use printf alot for debugging and I thought I was crazy trying to debug this and the log results would change. Turns out the printf doesn't print if you inside the if(is(INITRUN)) for somereason. Oh.. and you can change it to be a main() instead of a run() and it does the same thing. I've attached a zip file with 4 files, 2 .c and 2.log files that show the results I'm getting. Hopefully this can be repeated and fixed next release.

sorry if this is too long.

Thanks
P

Attached Files
atest.zip (1 downloads)