From 6453aec2ebbb05b98152c447390354f3cfd3b406 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 5 Nov 2012 17:10:07 +0000 Subject: [PATCH] fix readMSH for MSH version 1 --- Geo/GModelIO_MSH.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Geo/GModelIO_MSH.cpp b/Geo/GModelIO_MSH.cpp index 8d95a61769..4d2aa4c0b4 100644 --- a/Geo/GModelIO_MSH.cpp +++ b/Geo/GModelIO_MSH.cpp @@ -25,6 +25,16 @@ int GModel::readMSH(const std::string &name) } char str[256] = ""; + + // detect prehistoric MSH files + fgets(str, sizeof(str), fp); + if(!strncmp(&str[1], "NOD", 3)){ + fclose(fp); + return _readMSH2(name); + } + strcpy(str, ""); + rewind(fp); + double version = 0.; bool binary = false, swap = false, postpro = false; int minVertex = 0; -- GitLab