Menu

executeString function?

2009-01-09
2012-09-26
  • anonymous nobody

    Does C++ have a method in which you can run a string of code? For example:

    include <stdlib.h>

    int main()
    {
    int i;
    executeString("i=142");
    std::cout << i;
    system("pause");
    }

    to print 142 to the screen. This would allow the user to run code from the program.

    -J.M

     
    • anonymous nobody

      That would make sense. I learned my first programming language on an interpreted system, which included an execute_string function. Thanks.

      -J.M

       
    • cpns

      cpns - 2009-01-10

      Build your own expression evaluator such as http://www.arstdesign.com/articles/expression_evaluation.html or Google "embeddable scripting language". C is a compiled language, you are talking about an interpreter.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.