#include using namespace std; // to compile: // g++ -Wall -O5 parseKYG.C -o parseKYG.exe // to use: // curl -F "method_type=8" -F pdb_file=@1ETF_P.pdb http://cib.cf.ocha.ac.jp/KYG/KYG.php | ./parseKYG.exe //---------------------------------------------------------------------- void ExtractTD( string & strBuffer ) { size_t posB = strBuffer.find( ">", 0 ); if( string::npos == posB ) return; size_t posE = strBuffer.find( "<", posB ); if( string::npos == posE ) return; if( posE <= posB ) return; string strValue = strBuffer.substr( posB + 1, posE - posB - 1 ); cout << strValue << " \t"; } //---------------------------------------------------------------------- int main( int argc, char * argv [] ) { int iState = 0; string strBuffer; while( getline( cin, strBuffer ) ) { switch( iState ) { case 0: if( ( strBuffer.find( "" ) != string::npos ) || ( strBuffer.find( "" ) != string::npos ) ) iState = 2; else if( ( strBuffer.find( "" ) != string::npos ) || ( strBuffer.find( "" ) != string::npos ) ) iState = 1; break; case 2: if( ( strBuffer.find( "" ) != string::npos ) || ( strBuffer.find( "" ) != string::npos ) ) { cout << "\n"; iState = 1; } break; } } return( 0 ); }