Im learning C coding and have successfully used the code below to read from a txt file the single entry HSI0 or HSI1 and assign the one or zero to the variable CommandDirection.
I'm trying to expand that one entry to multiple entries, in order to assign to multiple variables.Code:LE * pFile; pFile = fopen ("R:\\SierraChart\\Commands.txt","r"); if (pFile!=NULL) { // obtain file size: long lSize; char filetxt[40]=""; char out[1]; fseek (pFile , 0 , SEEK_END); lSize = ftell (pFile); rewind (pFile); fread (filetxt,1,lSize,pFile); fclose (pFile); SCString InputString(filetxt), HSISymbol("HSI"); if(InputString.CompareNoCase(HSISymbol,3)==0) {out[0]=filetxt[3]; CommandDirection=atoi(out);} }
The code below doesn't work, but perhaps will give an idea what I'm trying to do.
new format in txt file entries:
HSI1
TESTA2
TESTB3
proposed enhancement:
so result would beCode:SCString InputString(filetxt), HSISymbol("HSI"); SCString InputString2(filetxt), testSymbolA("TESTA"); SCString InputString3(filetxt), testSymbolB("TESTB"); if(InputString.CompareNoCase(HSISymbol,3)==0) {out[0]=filetxt[3]; CommandDirection=atoi(out);} if(InputString2.CompareNoCase(testSymbolA,3)==0) {out[0]=filetxt[3]; CommandDirection2=atoi(out);} if(InputString3.CompareNoCase(testSymbolB,3)==0) {out[0]=filetxt[3]; CommandDirection3=atoi(out);}
CommandDirection=1
CommandDirection2=2
CommandDirection3=3
I am missing some parsing and assignment magic, please help.
There may be some Sierra Chart coding ACSIL specific functions in the above code, but I'm not positive.



LinkBack URL
About LinkBacks


