|
From: Ethan M. <merritt@u.washington.edu> - 2006-03-03 18:29:49
|
On Friday 03 March 2006 10:05 am, Petr Mikulik wrote:
> > A missing data file should no longer prevents the plot from being
> > constructed.
>
> No:
>
> gnuplot> plot 'a.dat', 'bla'
> ^
> can't read data file "bla"
> util.c: No such file or directory
OK. I'll try to fix that.
I guess it's only the "file exists but contains no data"
condition that is now acceptable.
> So, I'll commit the "fileexist" patch which uses fopen().
Can we discuss this some more first?
Or at least let me try out the patch first?
I'm not 100% convinced it will always work, even on linux.
> >> Actually, what some users ask for real-time plotting, is something
> >> like
> >> pause untilfileexist "next.dat"
> >> pause untilfilechanged "next.dat"
> >
> > I doubt there is a universally portable solution to this one.
> > It is difficult even if you restrict the solution to linux/unix.
>
> Why? What about "select" and "stat" functions?
I don't think these do what you want. "select" will tell you if
there is more data available to read on an open file. But you are
asking for a test that the file exists in the first place, which is an
entirely different question.
"stat" is essentially the same as "test", if you mean the command
line version. If you mean the library call "stat", I really have no
idea whether it is available outside of the usual linux/unix/POSIX
world. And even if the routine itself is available, I don't know if
the interpretation of the subfields describing modification time
is universal. You would have to do a lot of bookkeeping to
implement a gnuplot routine that essential did
if (file_has_changed_since_the_last_time_I_asked("filename"))
Could you track multiple file? What if the file no longer exists?
It seems to me easier to use system("find . -name <foo> -newer <bar>")
and let the system itself do all the bookkeeping. The "find" command
is in POSIX, so you get exactly the same level of guarantee that you
would for building in a call to "stat", with the advantage that if your
system doesn't follow POSIX you could fix it in your script file rather
than having to edit and rebuild from source.
--
Ethan A Merritt
Biomolecular Structure Center
University of Washington, Seattle WA
|