Skip to content
Prev 53800 / 63421 Next

write.csv

The best way to test on Windows would probably be creating a small virtual hard disk (via CreateVirtualDisk), mounting it, and writing to the mounted location. I believe the drive could even be mounted to an arbitrary location on the filesystem (instead of a drive letter) so that drive letter conflicts don't come into play.

-----Original Message-----
From: R-devel [mailto:r-devel-bounces at r-project.org] On Behalf Of Duncan Murdoch
Sent: Tuesday, July 4, 2017 7:53 AM
To: Jim Hester <james.f.hester at gmail.com>
Cc: r-devel at r-project.org; Lipatz Jean-Luc <jean-luc.lipatz at insee.fr>
Subject: Re: [Rd] write.csv
On 04/07/2017 10:01 AM, Jim Hester wrote:
Unfortunately, I get a permission denied error if I try to write there from MacOS.  I don't know if Windows has an equivalent.

I've taken a look at the code.  Essentially it comes down to a call to the C function vfprintf, which is supposed to return the number of bytes written, or a negative value for an error. This return value is often not checked; in particular, write.table and friends don't check it.

I'll add code to signal an error if there's a negative value.

I don't think it's feasible to check the number of bytes (formatted text with possible translation to a different encoding could have any number of bytes) if it's positive.  So hopefully all of our file systems will correctly signal an error, and not just report how many bytes were successfully written.
Loop devices sound ideal, but seem to be Linux-only (at least with that recipe).

Duncan
______________________________________________
R-devel at r-project.org mailing list
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-devel&data=02%7C01%7Cnsosnov%40microsoft.com%7Cb97a7371538b4dbe9a7308d4c2ec5aa0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636347767773809248&sdata=zMU5Ua2gL3fVPc%2FOPhfdciAdoHzwDyaRnKusZCnXqWo%3D&reserved=0