[Rd] seek() doesn't reposition a file connection (PR#1287)
garbade@psy.uni-muenchen.de
garbade@psy.uni-muenchen.de
Tue, 29 Jan 2002 10:39:29 +0100 (MET)
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._