cerr << "Last message: " << Decode (msgcode) << " eid:"; if ( msg . exists (F_EID) ) cerr << msg . getField (F_EID);
cerr << "Last message: " << Decode (msgcode) << " iid:"; if ( msg . exists (F_IID) ) cerr << msg . getField (F_IID);
int main (int argc, char ** argv){  Message_t msg;                           // the current message  ifstream msgfile;                        // the message file, if applicable  NCode_t msgcode;                         // current message NCode  streampos spos;                          // begin of the curr record  char * buff = NULL;                      // record buffer  streamsize size;                         // size of curr record  streamsize buff_size = 0;                // size of curr record buffer  set<NCode_t>::iterator endcode;          // end of the NCode set  //-- Parse the command line arguments  ParseArgs (argc, argv);    //-- BEGIN: MAIN EXCEPTION CATCH  try {  //-- Open the message file  msgfile . open (OPT_MessageName . c_str( ));  if ( !msgfile )    AMOS_THROW_IO ("Could not open message file " + OPT_MessageName);  spos = msgfile . tellg( );  //-- Parse the message file  endcode = OPT_ExtractCodes . end( );  while ( (msgcode = msg . skip (msgfile)) != NULL_NCODE )    {      if ( OPT_ExtractCodes . find (msgcode) != endcode )	{	  size = msgfile . tellg( ) - spos;	  if ( size > buff_size )	    {	      buff_size = size << 2;	      buff = (char *) SafeRealloc (buff, buff_size);	    }	  msgfile . seekg (-size, ifstream::cur);	  msgfile . read (buff, size);	  cout . write (buff, size);	}      spos = msgfile . tellg( );    }  }  catch (Exception_t & e) {  //-- On error, print debugging information  cerr << "Last message: " << Decode (msgcode) << " eid:";  if ( msg . exists (F_EID) )    cerr << msg . getField (F_EID);  cerr << "\nERROR: -- Fatal AMOS Exception --\n" << e;  return EXIT_FAILURE;  }  //-- END: MAIN EXCEPTION CATCH  msgfile . close( );  return EXIT_SUCCESS;}