Dear Igor,

This is a good one for the mailing list, so I'm cross-posting my reply.

On Tue, Aug 5, 2008 at 6:47 PM, Igor Filippov [Contr]
<[email protected]> wrote:
>
> Is there any way to convert a mol object into an SD file (i.e. CTAB plus
> user-defined properties) and have the result in a string?
> MolToMolBlock() only outputs CTAB portion without the properties.

Indeed there is. You can construct an SDWriter (defined in
$RDBASE/GraphMol/FileParsers/MolWriters.h) using a pointer to a
stringstream, then use the SDWriter's write() method. It's probably
safest to call the flush() method before reading your text out of the
stringstream.

An example for using this with a SmilesWriter is in the function
testSmilesWriter2() in testMolWriter.cpp. Using an SDWriter is exactly
equivalent.

-greg

Reply via email to