ripley@stats.ox.ac.uk
2002-Jan-29 09:52 UTC
[Rd] (PR#1287) seek was ignoring the `origin' argument (was
The original subject line is false. It *does* reposition, but `origin' was being ignored, so your request was to reposition to the beginning of the file, and that is what happened. This was already fixed in R-patched: from NEWS there: o seek() on file connections was ignoring the `origin' argument. It's always worth looking at the current patched version. On Tue, 29 Jan 2002 garbade@psy.uni-muenchen.de wrote:> Full_Name: Sven Garbade > Version: 1.4.0 > OS: Linux i386 > Submission from: (NULL) (129.187.254.49) > > > It seems that seek() can't reposition a file connection, but it can report the > actual file position correctly if the file connection was repositioned by > another function (e.g. readBin()). > > R code: > > > s <- file("p9_os/p9lr_all.mea","rb") > > s > description class mode > "p9_os/p9lr_all.mea" "file" "rb" > text opened can read > "binary" "opened" "yes" > can write > "no" > > seek(s, 0, "end") > [1] 0 > > seek(s) > [1] 0 # file connctor its still at the first position > > readBin(s, integer(), 64, size=2) > [1] 103 1 400 1 749 0 0 0 0 0 0 0 > [13] 0 0 0 0 0 0 0 0 0 0 0 0 > [25] 0 0 0 0 0 0 0 0 11884 25888 25977 11552 > [37] 22560 0 0 0 0 0 0 0 0 0 0 0 > [49] 0 0 0 0 0 0 0 0 0 0 0 0 > [61] 0 0 0 0 > > seek(s) > [1] 128 # here seek reports the correct postion > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._