Open Babel
3.0
obconversion_readstring.cpp
Reading a smiles string.
#include <
openbabel/obconversion.h
>
#include <
openbabel/mol.h
>
using namespace
OpenBabel
;
int
main()
{
// Create an OBConversion object.
OBConversion
conv;
// Set the input format.
if
(!conv.
SetInFormat
(
"smi"
)) {
// Handle error.
return
1;
}
// Create the OBMol object.
OBMol
mol;
// Read the smiles string.
if
(conv.
ReadString
(&mol,
"CCCC"
)) {
// Handle error.
return
1;
}
// ...Use OBMol object...
}
Generated on Tue Oct 15 2019 21:28:03 for Open Babel by
1.8.13