From: Gib Bogle on 10 Mar 2010 22:29 I want to check for the existence of a file, in order to determine whether the coast is clear to create this file. There is another process that opens the file, reads it, then removes it. The plan is to wait (sleep) until the file has been processed and deleted. INQUIRE(filename,EXIST=ex) doesn't seem to fit the bill, since this will return ex = .false. if the other process currently has the file open. What's the best way to do what I want?
From: Richard Maine on 10 Mar 2010 23:51 Gib Bogle <g.bogle(a)auckland.no.spam.ac.nz> wrote: > I want to check for the existence of a file, in order to determine whether > the coast is clear to create this file. There is another process that > opens the file, reads it, then removes it. The plan is to wait (sleep) > until the file has been processed and deleted. INQUIRE(filename,EXIST=ex) > doesn't seem to fit the bill, since this will return ex = .false. if the > other process currently has the file open. What's the best way to do what > I want? I have no idea why you are getting a false from that just because some other process has the file open. That makes little sense to me. Seems like that ought to be an answer and that if this is accurately reported, it would be a bug. A file doesn't cease to exist just because it is open. However... Using an OPEN with status='new' will get you an error on many systems if the file already exists. A caveat though is that on systems with file versions (VAX VMS), it wil just create a new version. -- Richard Maine | Good judgment comes from experience; email: last name at domain . net | experience comes from bad judgment. domain: summertriangle | -- Mark Twain
From: Sjouke Burry on 10 Mar 2010 23:58 Gib Bogle wrote: > I want to check for the existence of a file, in order to determine whether the > coast is clear to create this file. There is another process that opens the > file, reads it, then removes it. The plan is to wait (sleep) until the file has > been processed and deleted. INQUIRE(filename,EXIST=ex) doesn't seem to fit the > bill, since this will return ex = .false. if the other process currently has the > file open. What's the best way to do what I want? something like call system("dir [path_and_filename] > dirlist.txt") and reading the result in dirlist.txt? Then waiting a bit when the file is still around and repeat test? Choose the commands according to your OS.
From: Gib Bogle on 11 Mar 2010 00:30 Richard Maine wrote: > Gib Bogle <g.bogle(a)auckland.no.spam.ac.nz> wrote: > >> I want to check for the existence of a file, in order to determine whether >> the coast is clear to create this file. There is another process that >> opens the file, reads it, then removes it. The plan is to wait (sleep) >> until the file has been processed and deleted. INQUIRE(filename,EXIST=ex) >> doesn't seem to fit the bill, since this will return ex = .false. if the >> other process currently has the file open. What's the best way to do what >> I want? > > I have no idea why you are getting a false from that just because some > other process has the file open. That makes little sense to me. Seems > like that ought to be an answer and that if this is accurately reported, > it would be a bug. A file doesn't cease to exist just because it is > open. I'm not getting a false, I haven't coded this yet. Maybe I misinterpreted the Intel help info: ex Is a scalar default logical variable that is assigned one of the following values: ..TRUE. If the specified file exists and can be opened, or if the specified unit exists ..FALSE. If the specified file or unit does not exist or if the file exists but cannot be opened I was assuming that the file couldn't be opened if the other process had it open. > > However... > > Using an OPEN with status='new' will get you an error on many systems if > the file already exists. A caveat though is that on systems with file > versions (VAX VMS), it wil just create a new version. > I don't think I have to worry about VAXen.
From: Gib Bogle on 11 Mar 2010 00:31 Sjouke Burry wrote: > Gib Bogle wrote: >> I want to check for the existence of a file, in order to determine >> whether the coast is clear to create this file. There is another >> process that opens the file, reads it, then removes it. The plan is >> to wait (sleep) until the file has been processed and deleted. >> INQUIRE(filename,EXIST=ex) doesn't seem to fit the bill, since this >> will return ex = .false. if the other process currently has the file >> open. What's the best way to do what I want? > > something like call system("dir [path_and_filename] > dirlist.txt") > > and reading the result in dirlist.txt? > > Then waiting a bit when the file is still around and repeat test? > > Choose the commands according to your OS. That's certainly feasible, but a bit complicated.
|
Next
|
Last
Pages: 1 2 Prev: Build system for Fortran Next: buy Tramadol online without a prescription and no membership |