Hi, All,

I encountered a very strange and inconsistent error.

The script reads a file into a string and then into variables with sscanf().
Quote:
char* sFileName[20];
string RootDir="D:\";

void main()
{
string fn="2";
sprintf(sFileName,"%s%s%s",RootDir,fn,"_scanf_test.txt");

int records=0;

string fc=file_content(sFileName);

//string Format = "%i,%[^,],%[^,],%i,%i,%i,%i,%i,%i,%i,%f,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%f,%i,%f,%i,%i,%i,%f,%f,%i,%i,%i,%i,%f,%f,%i";
string Format = "%i,%[^,],%[^,],%i,%i,%i,%i,%i,%i,%i,%f,%i,%i";

int Sn;
char An[10];
char Al[10];
short TF1,TF2;
short dSt;
short dEt;
short Fr;
short Eo;
short prc;
float N;
short St;
short Et;


records=sscanf(fc,Format,&Sn,An,Al,&TF1,&TF2,&dSt,&dEt,&Fr,&Eo,&prc,&N,&St,&Et);

printf("n Sysno=%i,AssetName=%s,AlgoName=%s,EndOfWeek=%i,prc=%i,Norm=%f,StartTime=%i,EndTime=%i",Sn,An,Al,Eo,prc,(var)N,St,Et); //%f for float, %lf for var
}
This works as it should.

Now, this is a testing snippet. The real code reads some 40 params into a struct (first 13 fields defined identically to the above script and others are all similar).

Reading the string into struct fields, field nr. 12 gets skipped (i.e. the one before and the one after assumed correct values, but Nr12 - St - zero.

I checked all the types, tried changing short to int, etc - all is correct and identically defined fields before and after Nr12 get parsed correctly...

I worked around by defining another "short var" in the script, using it in sscanf() and then setting the needed field of the struct to this variable...
Which worked, until a day later another variable (Nr25) started to be skipped in a similar way...

Your thoughts are highly appreciated.