system and system2 in R [Software]

posted by Helmut Homepage – Vienna, Austria, 2022-08-30 13:25 (598 d 05:11 ago) – Posting: # 23243
Views: 1,711

Hi ElMaestro,

not sure why your original attempt failed.

A new one, missing the IO-declaration saved as FawltyTowers.c

int main() {
  printf("Hello, world!\n");
  return 0;
}

Then

x <- system(command = "gcc -Wall -O2 FawltyTowers.c -o FawltyTowers", intern = TRUE)
print(x)
[1] "FawltyTowers.c: In function 'main':"
[2] "FawltyTowers.c:2:3: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]"
[3] "    2 |   printf(\"Hello, world!\\n\");"
[4] "      |   ^~~~~~"
[5] "FawltyTowers.c:2:3: warning: incompatible implicit declaration of built-in function 'printf'"           
[6] "FawltyTowers.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'"
[7] "  +++ |+#include <stdio.h>"
[8] "    1 | int main() {"

The compiler is tolerant (warnings not a problem). FawltyTowers.c compiled successfully to FawltyTowers.exe, which differs from hw.exe only in the leading bytes at addresses 00088 and 000DB.

system(command = "FawltyTowers", intern = TRUE)
[1] "Hello, world!"


Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes

Complete thread:

UA Flag
Activity
 Admin contact
22,988 posts in 4,825 threads, 1,661 registered users;
93 visitors (1 registered, 92 guests [including 7 identified bots]).
Forum time: 18:36 CEST (Europe/Vienna)

The only way to comprehend what mathematicians mean by Infinity
is to contemplate the extent of human stupidity.    Voltaire

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5