Debian Codegraph @

man/CFILE.Rd

raw
1 \name{CFILE}
2 \Rdversion{1.1}
3 \alias{CFILE}
4 \alias{CFILE-class}
5 \alias{close,CFILE-method}
6 \title{Create a C-level handle for a file}
7 \description{
8 This function and class allow us to work with C-level
9 \code{FILE} handles.
10 The intent is to be able to pass these to \code{libcurl}
11 as options so that it can read or write from or to the file.
12 We can also do this with R connections and specify callback functions
13 that manipulate these connections. But using
14 the C-level FILE handle is likely to be significantly faster for large
15 files.
16
17 The \code{close} method allows us to explicitly flush and close the file
18 from within R.
19 }
20 \usage{
21 CFILE(filename, mode = "r")
22 }
23 \arguments{
24 \item{filename}{the name of the file on disk}
25 \item{mode}{a string specifying how to open the file, read or write, text or binary.}
26 }
27 \details{
28 This is a simple interface to the C routine \code{fopen}.
29 }
30 \value{
31 An object of class \code{CFILE} which is
32 has a single slot name \code{ref} which is an external pointer
33 holding the address of the FILE object in C.
34 }
35 \references{
36 Man page for \code{fopen}
37 }
38 \author{Duncan Temple Lang}
39
40 \seealso{
41 \code{\link{curlPerform}} and the \code{readdata}
42 }
43 \examples{
44 \dontrun{
45 filename = system.file("tests", "amazon3.R", package = "RCurl")
46 f = CFILE(filename)
47
48 if(url.exists('http://s3.amazonaws.com/'))
49 curlPerform(url = "http://s3.amazonaws.com/RRupload/duncan2",
50 upload = TRUE,
51 readdata = f@ref,
52 infilesize = file.info(filename)[1, "size"])
53 }
54 }
55 \keyword{IO}