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

V

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!
 
escape the quotes

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

Stefano

vivian wrote:
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!
 
Or use "ocean -restore file.ocn" instead of -b (which I didn't know existed!)

Andrew.

On Tue, 15 Nov 2005 13:14:13 -0800, Stefano Zanella <stefanoDOTzanella@pdf.com>
wrote:

escape the quotes

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

Stefano

vivian wrote:
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!
 
I tired system( "ocean -restore file.ocn"), c ++ compiler says bad
formed expression.
 
On 16 Nov 2005 08:38:40 -0800, "vivian" <wangllu@yahoo.com> wrote:

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

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

Andrew.
 
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".
 
Expert Andrew,

I am surprised that you dont even know '-b". At least it compiles
successfully.
It can not even compile with '-restore'.
 
On 16 Nov 2005 10:48:44 -0800, "vivian" <wangllu@yahoo.com> wrote:

Expert Andrew,

I am surprised that you dont even know '-b". At least it compiles
successfully.
It can not even compile with '-restore'.
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.
 
vivian wrote:
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!

Just when I was wondering wether I was getting grumpy and rude the last
times...
Thank you, you have put it all in perspective.
 
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!
 

Welcome to EDABoard.com

Sponsor

Back
Top