Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

call system command fotran 77

Status
Not open for further replies.

handenauer

Mechanical
Mar 7, 2012
3
I want a program to call gnuplot a plot data that the program produces, but i don't know exactly how the call system comand works. Ideally i want something like

call system(gnuplot plot 'blabla.dat')

Thank you!

(i'm using fotran77 and the compiler f77)
 
Replies continue below

Recommended for you

doing that i get this error:

Cannot open load file 'plot'
line 0: util.c: No such file or directory
 
You are probably running from the wrong directory. Two options

1) Change directory before making the system call. If you're using GFortran, the call is chdir. Other implemntations may have similar calls.
2) Use system to call a batch file which will go to the correct directory and call gnuplot.
 
Or, pass full path names for your files...I have found this to be the safest thing to do. This way, you can always leave the re-usable plot file in one place, and, depending on your run, pick up the blabla.dat file from the working directory, etc.

 
Ok, two things:

1.- The file i'm trying to plot can't be in another directory because it's produced by the same program in the same one.

2.- I understand from the error message that system tries to load a file called 'plot' instead of entering the command plot to gnuplot.

I think that the syntax ("gnuplot plot blabla.dat") is wrong. I had already tried adding quotes like that or

Call system("gnuplot plot 'blabla.dat'")

and none of them work..

 
perhaps single quotes?

TTFN
faq731-376
7ofakss
 
So, does the command "gnuplot plot blabla.dat" works from outside the Fortran program? directly from the command line?

 
Looks like it is trying to call "gnuplot plot xxx.dat".

Write the command into a batch file and then call the batch file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top