//minimal working example of the file name creation error
#define M1
#include <default.c>
#include <stdio.h>
//externs & inputs
// already should contain ticks in reversed order
string basePath = "E:FxData_SQ"; //can be anything, does not alter the result as no files are accessed at this stage
int start = 2007;
int end = 2010;
//functions
void createFileNames(int startYear, int endYear, string smbl)
{
printf("nentered createFileNames");
int y1; //for for() loop
//int y1 = start; //for while() loop
for(y1 = start; y1 <= end; y1++)
//while(y1 <= end)
{
//string symbol = smbl; //forcing smbl to be stored in another variable does not fix the issue
printf("nnProcessing year %d...for symbol %s...", y1, smbl);
//test #1
char inName[256];
char outName[256];
sprintf(inName, "%s%s_%d.csv", basePath, smbl, y1);
sprintf(outName, "%s%s_%d.t6", basePath, smbl, y1);
file_delete(outName);
//test #2, inName and outName do not seem to obey intialisation, concatenate on themselves)
/*string inName = "";
string outName = "";
inName = strf("%s%s_%d.csv", basePath, smbl, y1);
outName = strf("%s%s_%d.t6", basePath, smbl, y1);
file_delete(outName);
//end test #1
*/
printf("nIn File: %s", inName);
printf("nOut File: %s", outName);
//y1 += 1; //needed for while() loop
Sleep(5000);
}
}
//main
function main()
{
printf("nmain started");
string smbl = strx(Asset, "/", "");
printf("nMain() smbl = %s", smbl);
#ifdef M1
{ printf("nM1 defined, creating file names for %s", smbl);
createFileNames(start, end, smbl); }
#endif
}