X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkCommon.cxx;h=10f608e6ce8b7ba7c92d6085f4d1b1588a047e3d;hb=df17db96039a261139f654e6a4dc6cb51d967506;hp=b12f6f5d4b64eb17add326e8ae6dfd69e26d2c2d;hpb=573d80d0f7a17607d2ee883c21c940c0ba020282;p=clitk.git diff --git a/common/clitkCommon.cxx b/common/clitkCommon.cxx index b12f6f5..10f608e 100644 --- a/common/clitkCommon.cxx +++ b/common/clitkCommon.cxx @@ -41,7 +41,8 @@ void clitk::skipComment(std::istream & is) is >> c; if (is.eof()) return; } - is.unget(); + if (!(is.fail()) && c != '\n') + is.unget(); } //// //------------------------------------------------------------------ @@ -242,7 +243,7 @@ double clitk::ComputeEuclideanDistanceFromPointToPlane(const itk::ContinuousInde // Open a file for reading void clitk::openFileForReading(std::ifstream & is, const std::string & filename) { - is.open(filename.c_str(), std::ios::in); + is.open(filename.c_str(), std::ios::in | std::ios::binary); if ( is.fail() ) { clitkExceptionMacro("Could not open file for reading: " << filename << ". Error is : <"