[Rd] Binary file functions in R

Duncan Murdoch dmurdoch@pair.com
Fri, 30 Jun 2000 04:33:50 GMT

I've put together the first version of "Rstreams", a package that
allows binary access to files.  This version is for Windows only.
You can pick it up as
Comments are welcome!

Some known problems:

I tried to set it up as a package, but couldn't figure out from the
documentation where the .DLL should go.  It's sitting in the src
directory for now.

There are other things wrong with the organization as a package; R
says "no R code found" when I try to attach it.  If you want to use
it, you'll have to source the Rstreams.R file and dyn.load the DLL

I used the .C() interface to external functions, but I'm not sure how
it handles character vectors being returned from DLLs.  I'm sticking
string pointers into the result vector, which is likely to cause
memory problems, since I don't use Ralloc to allocate the strings.
How are you supposed to return a string value?  (This only applies to
the print method; it needs to find out the filename.  The readchar
method pre-allocates the space that's needed and uses that.)

The routines that I've implemented so far are:


One other comment for Robert G.::

Most of the information about a stream variable is kept in the DLL.
All that R gets is a handle.  This means you're safe to make
assignments of stream variables to other variables; both refer to the
same stream object in the DLL.  That's how I think environments should
be handled.

Again, comments are welcome!

Duncan Murdoch
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