execute C++ from String variable

前端 未结 6 927
北恋
北恋 2020-12-01 21:11

it is possible in C++ to execute the C++ code from string variable. Like in Javascript:

var theInstructions = \"alert(\'Hello World\'); var x = 100\";

var F         


        
6条回答
  •  情话喂你
    2020-12-01 21:35

    Directly, no. But you can:

    • write that string to a file.
    • invoke the compiler and compile that file.
    • execute the resulting binary.

提交回复
热议问题