Dear all,
same guy here trying to use the devel. lib of Openbabel for windows (msys, mingw64), thanks to Noel O'Boyle I managed to build the lib, and after that build my program ... only to see that I could not open a file using babel on windows, openbabel systematically fails on the conv.Read or conv.ReadFile instructions, and I have no clue why ...
any idea to help me ?

Thanks in advance for your help, again ...

Best regards.

Sébastien

Here is my code:

-------------------------------------------------------------------------------------------------------------------------------

 OBConversion conv;
 std::string filename;

 filename = this_file;
 std::string fileformat;

 fileformat = this_format;
 std::ifstream ifs(filename.c_str());

 if (! ifs)
{
  // Error reading file
  cout<<"Reading failed";
  return 1;
}

OBFormat * format = conv.FormatFromExt(fileformat.c_str());
if(! conv.SetInFormat(format))
{
  cout<<"Set In Format failed";
  // Error with this format
  return 2;
}

OBMol mol;
conv.AddOption("b", OBConversion::INOPTIONS);

if (! conv.Read(& mol, &ifs))
{

 // Error reading molecule in file
 cout<<"Reading molecule failed";

 // It always return at this point ...
 // Note that before I tried to open the file using "ReadFile (&mol, 
filename.c_str()))"
 // the result was the same.

 return 3;
}

if (mol.HasData(OBGenericDataType::UnitCell))
{
  OBUnitCell * uc = (OBUnitCell *)mol.GetData(OBGenericDataType::UnitCell);
  if (strcmp(this_format, "cif")  == 0) uc -> FillUnitCell (&mol);
}


-------------------------------------------------------------------------------------------------------------------------------

--
===========================================================
Dr. Sébastien Le Roux
Ingénieur de Recherche CNRS
Institut de Physique et Chimie des Matériaux de Strasbourg
Département des Matériaux Organiques
23, rue du Loess
BP 43
F-67034 Strasbourg Cedex 2, France
E-mail: sebastien.ler...@ipcms.unistra.fr
Webpage: http://www.ipcms.unistra.fr/?page_id=14965&lang=en
RINGS project: http://rings-code.sourceforge.net/
ISAACS project: http://isaacs.sourceforge.net/
Fax:   +33 3 88 10 72 46
Phone: +33 3 88 10 71 58
===========================================================


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to