Try:

      obErrorLog.StopLogging();

And/or you may need to use SetOutputLevel()
<http://openbabel.org/dev-api/classOpenBabel_1_1OBMessageHandler.shtml#ae467fbd6fca625ae5ee0ea066810280f>
.

Craig

On Sat, Aug 29, 2020 at 9:23 AM Wang, Jiyao (NIH/NLM/NCBI) [E] via
OpenBabel-discuss <openbabel-discuss@lists.sourceforge.net> wrote:

> Hi,
>
>
>
> I need to use openbabel to add hydrogens for ligands in PDB structures.
> The executable program works. But when I included the code as part of the
> C++ cgi, it has the error 500 because the output stream messed up with the
> output stream in cgi. I tried to comment out cout, printf, etc and it still
> didn’t work. Any suggestions?
>
>
>
> The compile alone caused the problem. I added the following to compile
> with openbabel library:
>
> =========
>
> CPPFLAGS = … \
>
>   -I /mypath/openbabel-openbabel-3-1-1/include/openbabel3
>
>
>
> LDFLAGS= -lopenbabel -L /mypath/delphi/openbabel-openbabel-3-1-1/lib
>
> =========
>
>
>
> Here is my small program:
>
> =========
>
> #include <iostream>
>
> #include <fstream>
>
>
>
> using namespace std;
>
> using namespace OpenBabel;
>
>
>
> string addHydrogen(string& pdbStr)
>
> {
>
>   string pdbHStr = "";
>
>
>
>   cout.rdbuf(NULL);
>
>   cerr.rdbuf(NULL);
>
>   clog.rdbuf(NULL);
>
>
>
>   OBConversion conv;
>
>   conv.SetInFormat("pdb");
>
>   conv.SetOutFormat("pdb");
>
>
>
>   OBMol mol;
>
>   //conv.ReadFile(&mol,filepath);
>
>   conv.ReadString(&mol,pdbStr);
>
>
>
>   mol.AddHydrogens();
>
>
>
>   //string filepath2 = "./test.pdbH";
>
>   //conv.WriteFile(&mol,filepath2.c_str());
>
>   bool trimWhitespace = true;
>
>   pdbHStr = conv.WriteString(&mol, trimWhitespace);
>
>
>
>   return pdbHStr;
>
> }
>
> =========
>
>
>
> Thanks!
>
>
>
> Jiyao Wang
>
>
>
>
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>


-- 
---------------------------------
Craig A. James
Chief Technology Officer
eMolecules, Inc.
3430 Carmel Mountain Road, Suite 250
San Diego, CA 92121
---------------------------------
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to