2 #include <Rinternals.h>
6 SEXP
lock_file(SEXP filename
)
11 if(!isString(filename
))
12 error("'filename' should be character");
13 PROTECT(status
= allocVector(INTSXP
, 1));
15 fd
= open(CHAR(STRING_ELT(filename
, 0)),
16 O_WRONLY
| O_CREAT
| O_EXCL
, 0666);
17 INTEGER(status
)[0] = fd
;