Skip to content
Snippets Groups Projects
Commit 0989562e authored by stefan's avatar stefan
Browse files

PDBWriter, fix locale bug

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2277 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 1e3d3baf
No related branches found
No related tags found
No related merge requests found
...@@ -19,8 +19,10 @@ ...@@ -19,8 +19,10 @@
/* /*
Author: Marco Biasini Author: Marco Biasini
*/ */
#include <locale>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <string.h> #include <string.h>
#include <ost/io/io_exception.hh> #include <ost/io/io_exception.hh>
#include "pdb_writer.hh" #include "pdb_writer.hh"
...@@ -257,6 +259,17 @@ private: ...@@ -257,6 +259,17 @@ private:
std::map<long,int>& atom_indices_; std::map<long,int>& atom_indices_;
}; };
struct ForcePOSIX {
std::locale old_locale;
ForcePOSIX(){
old_locale=std::locale();
setlocale(LC_NUMERIC, "POSIX");
}
~ForcePOSIX(){
setlocale(LC_NUMERIC, old_locale.name().c_str());
}
};
} }
PDBWriter::PDBWriter(std::ostream& stream): PDBWriter::PDBWriter(std::ostream& stream):
...@@ -295,6 +308,7 @@ void PDBWriter::WriteModelTrailer() ...@@ -295,6 +308,7 @@ void PDBWriter::WriteModelTrailer()
template <typename H> template <typename H>
void PDBWriter::WriteModel(H ent) void PDBWriter::WriteModel(H ent)
{ {
ForcePOSIX posix = ForcePOSIX();
this->WriteModelLeader(); this->WriteModelLeader();
PDBWriterImpl writer(outstream_,line_, atom_indices_); PDBWriterImpl writer(outstream_,line_, atom_indices_);
if (PDB::Flags() & PDB::PQR_FORMAT) { if (PDB::Flags() & PDB::PQR_FORMAT) {
...@@ -318,6 +332,7 @@ void PDBWriter::Write(const mol::EntityHandle& ent) ...@@ -318,6 +332,7 @@ void PDBWriter::Write(const mol::EntityHandle& ent)
void PDBWriter::Write(const mol::AtomHandleList& atoms) void PDBWriter::Write(const mol::AtomHandleList& atoms)
{ {
ForcePOSIX posix = ForcePOSIX();
this->WriteModelLeader(); this->WriteModelLeader();
int counter=1; int counter=1;
mol::ChainHandle last_chain; mol::ChainHandle last_chain;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment