[Rd] file.copy() problems on WinNT (PR#1085)

ligges@amadeus.statistik.uni-dortmund.de ligges@amadeus.statistik.uni-dortmund.de
Fri, 7 Sep 2001 13:07:03 +0200 (MET DST)


Prof Brian Ripley wrote:
> 
> Looks like it is written to expect text files.
> 
> Please try making the file opens in R_AppedFile binary, and tell us if
> that solves it.

You are right. Changing "a" to "ab" and "r" to "rb" in the following
lines of R_AppendFile (file: /src/main/platform.c) solves the problem.


    if((fp1 = R_fopen(R_ExpandFileName(file1), "a")) == NULL) {
        return 0;
    }
    if((fp2 = R_fopen(R_ExpandFileName(file2), "r")) == NULL) {


Thank you!

Uwe Ligges


> On Thu, 6 Sep 2001 ligges@amadeus.statistik.uni-dortmund.de wrote:
> 
> > For some files, file.copy() doesn't copy these files correctly.
> >
> > Here you will find a file (Bitmap, 769Kb) to reproduce the problem:
> >  http://www.statistik.uni-dortmund.de/leute/ligges/R/test1.bmp
> >
> > Using
> >  file.copy("c:/test1.bmp", "c:/test2.bmp", overwrite = TRUE)
> > produces a second file with the size of ~1.4 Mb:
> >  http://www.statistik.uni-dortmund.de/leute/ligges/R/test2.bmp
> >
> > To reduce size, I put both files into following zip archive:
> >  http://www.statistik.uni-dortmund.de/leute/ligges/R/test.zip
> >
> > Using file.copy() with the same file on Solaris and Linux works fine.
> >
> > Uwe Ligges
> >
> >
> > --please do not edit the information below--
> >
> > Version:
> >  platform = i386-pc-mingw32
> >  arch = x86
> >  os = Win32
> >  system = x86, Win32
> >  status =
> >  major = 1
> >  minor = 3.1
> >  year = 2001
> >  month = 08
> >  day = 31
> >  language = R
> >
> > Windows NT 4.0 (build 1381) Service Pack 6
> >
> > Search Path:
> >  .GlobalEnv, package:ctest, Autoloads, package:base

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._