[Rcpp-devel] Need some hep reading files

Roberto Spadim roberto at spadim.com.br
Fri Jul 29 23:43:55 CEST 2022


I don't know if I'm  clear in last message
What I want to do is something like this, but i don't know if Rcpp can
'convert' the ifstream to SEXP and keep the object intact:

One RCPP function to open the file and return the "ifstream" object

ifstream some_open_function(){
  ifstream infile;
  infile.open("afile.dat");
  return infile;
}

one read function:

string read_file(ifstream infile){
  string data;
  infile >> data;
  return data;
}

one close function:

void close_file(ifstream infile){
   infile.close();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20220729/cb872de1/attachment.html>


More information about the Rcpp-devel mailing list