Displaying 1 result from an estimated 1 matches for "read_clim".
Did you mean:
read_clk
2005 Feb 03
1
filling a string buffer in a C routine
...R.h>
void read_file(char **filename, char **buf, char **buflen) {
FILE *infile;
infile = fopen(*filename, "r");
fgets(*buf, *buflen, infile);
fclose(infile);
}
--- R code ---
buffer = "xxxxxxxxxx" # kludge!
read.file <- function(filename)
.C("read_climate",
as.character(filename),
buf=buffer,
buflen=as.integer(10))$buf
--- end code ---
This works okay, but the only way I could find to allocate a string
buffer of the size I want is to use a string literal as in the line
marked "kludge" above. It is impractical for l...