Anybody knows how to use system call in c++ to call ocean?

Discussion in 'Cadence' started by vivian, Nov 15, 2005.

  1. vivian

    vivian Guest

    I want to call "oean" in c++ program. Since in ocean, you have to use
    load("filename.ocn") i n ocean prompts to run the simulation.

    In c++, I use

    system("ocean -b load("file.ocn") > file.out");

    There is syntax error.

    how to use system call ? thanks a lot!
     
    vivian, Nov 15, 2005
    #1
  2. Or use "ocean -restore file.ocn" instead of -b (which I didn't know existed!)

    Andrew.
     
    Andrew Beckett, Nov 15, 2005
    #2
  3. vivian

    vivian Guest

    I tired system( "ocean -restore file.ocn"), c ++ compiler says bad
    formed expression.
     
    vivian, Nov 16, 2005
    #3
  4. Don't see why - this is a normal C function.

    Still, you're not exactly giving anyone much to work on...

    Andrew.
     
    Andrew Beckett, Nov 16, 2005
    #4
  5. vivian

    vivian Guest

    Stefano, Thank you for your reply. I tried it. It compiles successful.
    When I run it, still got some error:

    sh: syntax error at line 1: `(' unexpected

    I think it is the '(' after "load".
     
    vivian, Nov 16, 2005
    #5
  6. vivian

    vivian Guest

    Expert Andrew,

    I am surprised that you dont even know '-b". At least it compiles
    successfully.
    It can not even compile with '-restore'.
     
    vivian, Nov 16, 2005
    #6
  7. Well, from the UNIX prompt I tried:

    ocean -b 'load("myscript.ocn")'

    and it did nothing except start ocean interactively - which is what
    it would have done without the -b arg.

    So from my experiments, -b is not a supported argument of the Cadence "ocean"
    executable - which might explain why I've not come across it.

    Perhaps you have a wrapper called "ocean" around the Cadence "ocean" executable
    which implements the -b arg, and stops the -restore argument from being passed
    (-restore definitely should work with the Cadence executable)?

    I can't see why the command should affect the compilation of the C++ code - it's
    just a string, so it wouldn't care until run time.

    Regards,

    Andrew.
     
    Andrew Beckett, Nov 16, 2005
    #7
  8. vivian

    vivian Guest

    Finally, I solved the problem.

    First, write the following in the file "myFile":

    load("file.ocn")

    then, in c++, write:

    system("ocean < myFile >> file.out ");

    It runs successfully.

    Thank all the people who helped me!
     
    vivian, Nov 17, 2005
    #8
  9. vivian

    fogh Guest

    Just when I was wondering wether I was getting grumpy and rude the last
    times...
    Thank you, you have put it all in perspective.
     
    fogh, Nov 18, 2005
    #9
Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.