Hey, I have a code like this:

Code:
action = "";
strcat(action, "Strategy/ghost.py ");
strcat(action, strf("'%s' ", Asset));
strcat(action, strf("%d ", Money));
strcat(action, strf("%d ", ExitTime));
strcat(action, "'90% / 0%' ");
strcat(action, "'put'");
printf("\nCreated action...");
exec(action_file, action, 1);
printf("\n%s\n\n", action);
Sleep(33);



This is a part of a function that is called when the trade is executed. Unfortunately it's failing with a crash in script and inconsistent series calls, sometimes in other configurations it gives a trade in one direction but I'm never able to repeat a trade in that direction with another crash in script. Please tell me how should I create a string that is recreated every time I place a trade.

There is no problem with exec function, it's called properly, the output of current stage is failing and printing my string, but not "Created action...". I'm not good with C, I've always worked on higher-level languages starting with C++ and I'm not clearly sure how to go about this string interpolation...

What is strange, is that this code works well when the function is called just once, like you would make a separate program with just that code and a global string action, but this is not the case.

Last edited by neosb; 11/14/15 18:59. Reason: additional info about issue with string interpolation