Bennett Helm wrote:

> On Feb 16, 2005, at 1:38 PM, Angus Leeming wrote:
> 
>> Just to be crystal clear: does it work if you change
>> -    ifstream ifs(from.c_str(), ios::binary);
>> +    ifstream ifs(from.c_str());
> 
> Yes. (As does LyX when I make that change in copy.C.)

Then since Windows caused the bother here, I suggest modifying the LyX 
code to read

 bool lyx_copy(string const & from, string const & to)
 {
+#if defined (WIN32)
     ifstream ifs(from.c_str(), ios::binary);
+#else
+    // A bug in the gcc 2.95 implementation of ifstream
+    // means that we can't use ios::binary here (even though
+    // it should have no effect on unix machines).
+    ifstream ifs(from.c_str());
+#endif

     if (!ifs)
         return false;
     ofstream ofs(to.c_str(),
                  ios::binary | ios::out | ios::trunc);
     if (!ofs)
         return false;
     ofs << ifs.rdbuf();
     if (ofs.good())
         return true;
     return false;
 }

I'll make a patch.

-- 
Angus

Reply via email to