The following code uses the OEMolBase::GetTitle method to list
the names of the molecules in an MDL SD file. The input file is read from
standard-in and the list of identifiers (molecule names) are written to
standard-out.
#include "oechem.h"
#include <iostream>
using namespace OEChem;
using namespace OESystem;
using namespace std;
int main()
{
OEIter<OEMolBase> mol;
oemolistream ims;
ims.SetFormat(OEFormat::SDF);
for (mol=ims.GetMolBases(); mol; ++mol)
cout << mol->GetTitle() << endl;
return 0;
}