On 30/06/2011 12:55, Marianne wrote:
> Ok, now I can use different input files with FullConvert. The code look like
> that if it is of any help for someone:
>
> *-----------------
>       string filename ="molfiles/1.mol";
>       vector<string>  inputfiles;
>       inputfiles.push_back(filename);
>       filename ="molfiles/2.mol";
>       inputfiles.push_back(filename);
>       vector<string>  outputfiles;
>       outputfiles.push_back("test.sdf");
>       conv.SetInAndOutFormats("mol","sdf");
>       filename="test.sdf";
>
>       conv.AddOption("gen3D" "m",conv.GENOPTIONS);
>       conv.FullConvert(inputfiles, filename,outputfiles);
>       conv.CloseOutFile();
>
> -----------------*
>
> But the question about the possibility to use the wildcard * on the API stay
> in suspend. Is it possible?
>
>
> By checking the code commentary of FullConvert:
>
>      Batch Conversion
>       Done if FileList has more than one file name and contains a * .
>       Each input file is converted to an output file whose name is
>       OutputFileName with the * replaced by the inputfile name without its
>       path and extension.
>       So if the input files were inpath/First.cml, inpath/Second.cml
>       and OutputFileName was NEW*.mol, the output files would be
>       NEWFirst.mol, NEWSecond.mol.
>
> Seems that it is possible? When I do it, it did not work. I make propably
> somethings wrong or it is only possible with batch interaction?

The interpretation of * as a wildcard character is an operating system 
(or shell) function. So it needs platform-dependent code. The expansion 
of a filename containing a * to a list of filenames happens on the 
commandline for linux and in DLHandler::findFiles(), called from main() 
(in obabel.cpp) for Windows. I think this function will work for all 
platforms and is what you probably need to use in your code.

The Windows commandline uses * in the output file to indicate a batch 
operation. Linux has to use the -m option but obabel then adds a * to 
the filename. OBConversion::FullConvert uses the presence of a * in an 
output file name as a signal to do a splitting or batch operation.

The "m" in
conv.AddOption("gen3D" "m",conv.GENOPTIONS);
is not doing anything. You need a separate AddOption statement for each 
option, and anyway -m is interpreted in obabel and not later in the 
conversion process.


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to