RInside Version 0.2.6
inst/examples/standard/rinside_test0.cpp
Go to the documentation of this file.
00001 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4;  tab-width: 8; -*-
00002 //
00003 // Simple test that did not trigger the bug reported by Miguel Lechón
00004 //
00005 // Copyright (C) 2009 Dirk Eddelbuettel and GPL'ed 
00006 
00007 #include <RInside.h>                    // for the embedded R via RInside
00008 
00009 int main(int argc, char *argv[]) {
00010 
00011     RInside R(argc, argv);              // create an embedded R instance 
00012     
00013     std::string txt = "Hello, world!\n";// assign a standard C++ string to 'txt'
00014     R.assign( txt, "txt");              // assign string var to R variable 'txt'
00015 
00016     std::string evalstr = "cat(txt)";
00017     for (int i=0; i<1e1; i++) {
00018         R.parseEvalQ(evalstr);          // eval the init string, ignoring any returns
00019     }
00020     evalstr = "txt <- \"foo\\n\"";
00021     for (int i=0; i<1e6; i++) {
00022         R.parseEvalQ(evalstr);          // eval the init string, ignoring any returns
00023     }
00024     evalstr = "cat(txt)";
00025     for (int i=0; i<1e1; i++) {
00026         R.parseEvalQ(evalstr);          // eval the init string, ignoring any returns
00027     }
00028     exit(0);
00029 }
00030 
 All Classes Files Functions Variables Enumerations Enumerator Defines