2

I made a console application in C#, and I want to execute it from R. I am trying to run the code system(url) where url is the location of the file in the directory ApplicationPath/Bin/Debug.

I get this error when I do it: Warning message: running command ... had status 127.

Do I need to compile my code in Visual Studio in a particular way to get it to run? It's worth noting that another console application that I made the exact same way (at least I thought) does work using this method. The only difference I notice is that in the Debug folder, the one that works has a Visual Studio Solution User Options file, and the other does not. I'm not sure if that makes a difference, but if so how do you create that?

Eric Brooks
  • 657
  • 5
  • 13
  • Well, 127 means that the specified procedure could not be found..I'm thinking about a wrong syntax, or link or something like this.. – dpaul1994 Jul 23 '15 at 19:00
  • This is the exact line that I'm using: `system("M:\\Eric\\Programs\\calculation\\calculation\\bin\\Debug\\calculation")`. calculation is the name of the program. The same syntax was used in the program that works. – Eric Brooks Jul 23 '15 at 19:12
  • Then copy the calculation file in R folder and run it again – dpaul1994 Jul 23 '15 at 19:13
  • Sorry, which folder do you mean by R folder? – Eric Brooks Jul 23 '15 at 19:21
  • Release? Is not that what you wanted to do? – dpaul1994 Jul 23 '15 at 19:26
  • haha yes, I just got caught up because in context "R" seemed to refer to folder that held the R programming language. anyway, tried that too and it didn't work. – Eric Brooks Jul 23 '15 at 19:35
  • Aaaa ok then. Have you tried to change the link syntax with "\" or "/" instead of "\\" ? – dpaul1994 Jul 23 '15 at 19:40
  • I have a solution: run it as `system(paste0(" cmd/K \"",url,"\""))`, which has it call the file from command prompt. This is more a workaround than an explanation of why what I was doing doesn't work, but at least now I have it working. – Eric Brooks Jul 23 '15 at 19:54
  • I see, well I'm glad then :) – dpaul1994 Jul 23 '15 at 20:27
  • @EricBrooks I have kind of the same issue. Would you mind having a look at my question [here](http://stackoverflow.com/questions/36431465/running-exe-from-r-status-127-warning-on-linux-not-on-windows)? Many thanks in advance. – Antoine Apr 06 '16 at 09:13

0 Answers0