RInside Version 0.2.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
rinside_test0.cpp
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8; -*-
2 //
3 // Simple test that did not trigger the bug reported by Miguel Lechón
4 //
5 // Copyright (C) 2009 - 2014 Dirk Eddelbuettel and GPL'ed
6 
7 #include <RInside.h> // for the embedded R via RInside
8 
9 int main(int argc, char *argv[]) {
10 
11  RInside R(argc, argv); // create an embedded R instance
12 
13  std::string txt = "Hello, world!\n";// assign a standard C++ string to 'txt'
14  R["txt"] = txt; // assign string var to R variable 'txt'
15 
16  std::string evalstr = "cat(txt)";
17  for (int i=0; i<1e1; i++) {
18  R.parseEvalQ(evalstr); // eval the init string, ignoring any returns
19  }
20  evalstr = "txt <- \"foo\\n\"";
21  for (int i=0; i<1e1; i++) {
22  R.parseEvalQ(evalstr); // eval the init string, ignoring any returns
23  }
24  evalstr = "cat(txt)";
25  for (int i=0; i<1e1; i++) {
26  R.parseEvalQ(evalstr); // eval the init string, ignoring any returns
27  }
28  exit(0);
29 }
30 
int main(int argc, char *argv[])
void parseEvalQ(const std::string &line)
Definition: RInside.cpp:366