[Rd] unlink() is not synchronized with existing connections
(PR#783)
Prof Brian Ripley
ripley@stats.ox.ac.uk
Wed, 20 Dec 2000 12:47:30 +0000 (GMT)
On Wed, 20 Dec 2000 joehl@web.de wrote:
> > # creating a file
> > cat("sddfasdf", file="tempfile")
> > showConnections()
> class description mode text isopen can read can write
> > con <- file("tempfile", "r")
> > readLines(con)
> [1] "sddfasdf"
> Warning message:
> incomplete final line in: readLines(con, n, ok)
> > showConnections()
> class description mode text isopen can read can write
> 3 "tempfile" "file" "r" "text" "opened" "yes" "no"
> > unlink("tempfile")
> > showConnections()
> class description mode text isopen can read can write
> 3 "tempfile" "file" "r" "text" "opened" "yes" "no"
> > # now we have an opened (read) connection to a non-existing file left
What's the problem? That's perfectly valid on OSes that support it (e.g.
Unix and Windows NT). Unlinked files are *not* `non-existing'.
> cat("sddfasdf", file="tempfile")
> con <- file("tempfile", "r")
> unlink("tempfile")
> readLines(con)
[1] "sddfasdf"
Warning message:
incomplete final line in: readLines(con, n, ok)
> close(con)
I am not sure what your point is here. Connections are experimental and
we know it is possible to do silly things with them. But why would one?
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._