void readGeomFromText(char *fileName) { ifstream fin(fileName); double* mobile = new double[24]; char wordBuf[200]={0}; while(!fin.eof()) { fin >> wordBuf; if(!fin.eof()) { char newFileName[100] = {0}; strcpy(newFileName, "Met"); strcat(newFileName, wordBuf); double ordinate = atof(wordBuf); fin >> wordBuf; double object = atof(wordBuf); for(int i=0; i<24; i++) { fin>>wordBuf; mobile[i] =atof(wordBuf); } writePDB(mobile, newFileName); cout << ordinate << "\t" << object << endl; } }
/* * Saves data from PDB object into a PDB file format * * For detailed information about PDB file format, please visit * http://www.wwpdb.org/documentation/format23/sect6.html * * Parameters: * filename: name of a file to save into (will be overwritten/created) * pdbData: pointer of an object to get data from */ void writePDB(const char* filename, PDB* pdbData){ writePDB(filename, pdbData, 0); }