From dc9230301ab43afeeb0fea135a6b74413c0cb17c Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 25 Feb 2006 07:32:42 +0000
Subject: [PATCH] fix user-defined functions: text mode messes up
 fsetpos/getpos: weird

---
 Parser/OpenFile.cpp | 8 +++++---
 TODO                | 7 +------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp
index 67f3e5cb3d..794fc1f0b6 100644
--- a/Parser/OpenFile.cpp
+++ b/Parser/OpenFile.cpp
@@ -1,4 +1,4 @@
-// $Id: OpenFile.cpp,v 1.91 2006-02-25 07:22:11 geuzaine Exp $
+// $Id: OpenFile.cpp,v 1.92 2006-02-25 07:32:42 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -141,7 +141,9 @@ int ParseFile(char *f, int silent, int close, int warn_if_missing)
   FILE *yyin_old, *fp;
   int yylineno_old, yyerrorstate_old, numviews_old, status;
 
-  if(!(fp = fopen(f, "r"))){
+  // add 'b' for pure Windows programs: opening in text mode messes up
+  // fsetpos/fgetpos (used e.g. for user-defined functions)
+  if(!(fp = fopen(f, "rb"))){
     if(warn_if_missing)
       Msg(WARNING, "Unable to open file '%s'", f);
     return 0;
@@ -242,7 +244,7 @@ int MergeProblem(char *name, int warn_if_missing)
   int status;
   FILE *fp;
 
-  // add 'b' for pure Windows programs, since some of these files
+  // added 'b' for pure Windows programs, since some of these files
   // contain binary data
   if(!(fp = fopen(name, "rb"))){
     if(warn_if_missing)
diff --git a/TODO b/TODO
index e845af13bf..21ef5b5047 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-$Id: TODO,v 1.123 2006-02-25 07:02:20 geuzaine Exp $
+$Id: TODO,v 1.124 2006-02-25 07:32:42 geuzaine Exp $
 
 ********************************************************************
 
@@ -37,11 +37,6 @@ curve/surface/volume or loop over all elements.)
 
 ********************************************************************
 
-On Windows WITHOUT Cygwin:
-- Functions in parser don't seem to work
-
-********************************************************************
-
 allow mixed 1st/2nd order meshes (2nd order only where the geometry
 requires it). Add this as an advanced option since it will create
 meshes with hanging nodes.
-- 
GitLab