Hi Friends,
I am writing a monte carlo program. I have made a structure which had different 20 objects like ALA[5], CYS[5], PRO[5], ARG[34] , MET[15]....and so on.
//this is defined in a global.cpp file//
typedef struct libaa{
int num;
char amino[4];
float chi1,chi2,chi3,chi4,phi,psi,omega;
};
libaa ALA[1],CYS[4],ASP[8],GLU[15],GLN[15],PHE[5],GLY[2],HIS[8],HIE[8],ILE[7],LYS[27],LEU[5],MET[13],ASN[9],PRO[3],ARG[34],SER[3],THR[3],VAL[3],TRP[7],TYR[5];
//in my main program/////
int k=1;
while(k<21)
{
lib=fopen(fname,"r"); //fname contains the name of the 21 files
while(fgets(st2,120,lib)!=NULL)
{
sscanf(st2,"%d ",&fname[i].num);
i++;
}
k++;
fclose(lib);
}
lib points to 21 different file like ALA
ALA files contains some information. similarly CYS, GLU, MET and all other.
My problem is I want it to scan automatically to the structure arrays depending upon fname . If fname is ALA
it should do sscanf(st2,"%d",&fname.num);
Its showing error, its actually not replacing fname with its value ALA or others. PLease suggest me some way to solve this problem..
Pls lemme know if the problem is not clear
thnx Pinky