OEWriteMolToStringΒΆ

std::string OEWriteMolToString(const std::string &format, const OEMolBase &mol)
std::string OEWriteMolToString(unsigned format, bool gzip, const OEMolBase &mol)

std::string OEWriteMolToString(const std::string &format, const OEMCMolBase &mol)
std::string OEWriteMolToString(unsigned format, bool gzip, const OEMCMolBase &mol)

bool OEWriteMolToString(std::string& molstring, unsigned int format, bool gzip, const OEMolBase& mol)
bool OEWriteMolToString(std::string& molstring, unsigned int format, bool gzip, const OEMCMolBase& mol)

Encodes a molecule in terms of ‘format’. ‘format’ must be a file extension that is writeable by OpenEye. For example: ”.oeb.gz”. Overloads with a Boolean gzip parameter expect format to be specified by a constant in OEFormat.

Overloads which take an extra string reference and return boolean write the result in the provided string and return true if encoding into the given string was successful.

Otherwise, returns a non-empty std::string if encoding was successful.

OEGraphMol mol;
OESmilesToMol(mol, "c1ccccc1"); 
std::string bytes = OEWriteMolToString(".oeb", mol);
OEGraphMol mol;
OESmilesToMol(mol, "c1ccccc1"); 
std::string bytes = OEWriteMolToString(OEFormat::OEB, false, mol);