Re: accessing newly-created files
Re: accessing newly-created files
- Subject: Re: accessing newly-created files
- From: "David Piasecki" <email@hidden>
- Date: Thu, 15 Apr 2004 15:31:57 -0700
That's what I thought, but I got some error message saying the end of
file had not been reached. When I loaded the new image via a button
click action, it worked just fine. That's what gave me the idea to let
it sleep for a second before accessing the image. I'm using the GRASS
program d.mon to write a PNG file to disk.
I have a C++ class I call MyTerminal that has an ExecuteCommand method.
ExecuteCommand is as follows...
void ExecuteCommand( char *command )
{
system(command);
}
I call myterminal->ExecuteCommand( "d.mon stop=PNG") to write the image
file to disk.
David
On Apr 15, 2004, at 3:07 PM, Pete Yandell wrote:
Normally a call to system() won't return until the command you pass to
it has finished executing. What program are you using to create the
image file and how are you calling system()?
Pete Yandell
http://pete.yandell.com/
On 16/04/2004, at 5:04 AM, David Piasecki wrote:
I use a system call to execute a program which creates an image file
that I want to display directly after it is written. For some reason,
it seems to tell the OS to write the file, and then it returns before
the file is actually written. So when my next call attempts to read
the file, I get an error. I got around this by calling the standard C
sleep function; however, sleep only takes increments of seconds. 1
second was plenty of time for the ~30K file to be written, but I'd
rather not wait that long, and it's not a good way of handling
things. Rather, I would like to perform a check for the status of the
file to make sure it's all there before attempting a read operation.
Is there a way to do this?
David
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.