Posted By: budfox
String from R to Zorro - 02/22/22 09:03
Hi there,
I'm currently trying to read strings from R into Zorro. I tried using Rd and Rv but I'm just not getting it.
I was wondering if someone could share a simple example or give me a hint? I included my current status below...
I was trying to store assetnames into a struct containing strings.
Thanks for any help!
I'm currently trying to read strings from R into Zorro. I tried using Rd and Rv but I'm just not getting it.
I was wondering if someone could share a simple example or give me a hint? I included my current status below...
Code
#include <r.h> typedef struct { string Asset1; string Asset2; } Pairs; function run() { set(PLOTNOW); StartDate = 2015; EndDate = 20190101; BarPeriod = 5 * 1440; static Pairs Pair1; // --------------------------------------- // Startup and data loading // --------------------------------------- if(is(INITRUN)) { printf("Script is running!\n"); // start R if(!Rstart("Test.R", 2)) { print("Error - can't start R session!"); quit(); } } Rx("testnames <- testfunction()", 2); Pair1.Asset1 = Rd("testnamen[[1]]"); // Doens't work due to Pointer Error - Can't figure it out Rv("testnamen", Pair1.Asset1, 2); // No Error but no value in Pair.Asset1 printf("Test Wert 1: %s\n", Pair1.Asset1); watch("!----\n"); } R Code: testfunction <- function() { return(c("Asset", "Name")) }
I was trying to store assetnames into a struct containing strings.
Thanks for any help!