evaluate a string expression in if statement Linux C/C++

Discussion in 'C++' started by parul.prasad@wipro.com, Nov 14, 2006.

  1. Guest

    How can we evaluate a string expression in if statement Linux C/C++
     
    , Nov 14, 2006
    #1
    1. Advertising

  2. If you have only one const (e.g. one number), there is a lot of
    functions/class for str->int (or double, or float, or ...) conversion
    (like std::strstream).

    If it is expression of type 123+12-123/123, you must write some kind of
    parser/evaluator (look for conversion of infix <-> sufix form).

    Best,
    Zaharije Pasalic
     
    PasalicZaharije, Nov 14, 2006
    #2
    1. Advertising

  3. ondra.holub Guest

    If you do not want to write parser, you can embed some scripting
    language (for example python) in your C/C++ program and evaluate the
    expression in this embedded scripting language. Yes, this is overkill,
    but on the other hand it is very quick - there is enough to simply
    modify first embedding tutorial you find.
     
    ondra.holub, Nov 14, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marco Traverso
    Replies:
    7
    Views:
    1,754
    Marco Traverso
    Dec 6, 2003
  2. Jim Florence
    Replies:
    3
    Views:
    6,841
    Ken Cox [Microsoft MVP]
    Jun 25, 2006
  3. Jason luo
    Replies:
    3
    Views:
    579
    Peter Ammon
    Aug 19, 2004
  4. No Such Luck

    Evaluate string expression in if statement?

    No Such Luck, Dec 7, 2005, in forum: C Programming
    Replies:
    8
    Views:
    408
    Richard Heathfield
    Dec 8, 2005
  5. waltbrad

    I cannot evaluate this statement...

    waltbrad, Mar 7, 2008, in forum: Python
    Replies:
    5
    Views:
    306
    John Machin
    Mar 7, 2008
Loading...

Share This Page