State of the file
by Gennady · in Torque 3D Beginner · 07/09/2011 (9:56 pm) · 6 replies
Good day!
Here I'm asking how to check the accessibility of file: is it ready for read/write or not.
Such question is because I have 2 programs (Torque and Win32) that interact with one file, so there are a lot of situations of "double access" and so both programs can't read or write this file. That's why I need to check the file's state with TorqueScript.
Thanks!
Here I'm asking how to check the accessibility of file: is it ready for read/write or not.
Such question is because I have 2 programs (Torque and Win32) that interact with one file, so there are a lot of situations of "double access" and so both programs can't read or write this file. That's why I need to check the file's state with TorqueScript.
Thanks!
About the author
Specialist of International center for professional training in Rosatom Technical Academy
#2
07/11/2011 (9:41 am)
That was the first I've thought about. I've tried to check openForRead() return value - it doesn't work with .jpg files, only with text files.
#3
May be somebody knows another way how to read the image file which is rewriting 25 times in minute?
09/22/2011 (8:55 pm)
Okey then.. May be somebody knows another way how to read the image file which is rewriting 25 times in minute?
#4
You have two applications trying to read and write to the same jpg file? Or is one file reading while the other one is writing?
Sounds like you're looking for a File Locking solution: http://en.wikipedia.org/wiki/File_locking
09/23/2011 (12:18 pm)
I think we need more information on what you need to have happen.You have two applications trying to read and write to the same jpg file? Or is one file reading while the other one is writing?
Sounds like you're looking for a File Locking solution: http://en.wikipedia.org/wiki/File_locking
#5
Let me know if that works for you.
09/23/2011 (12:27 pm)
If my memory serves me, each platform handles file locking differently. I think the 'LockFile' is the command you're looking for on Win32: http://msdn.microsoft.com/en-us/library/aa365202%28VS.85%29.aspxLet me know if that works for you.
#6
Thank you for the links, I read it. But I suppose that there it's another situation: functions LockFile and UnlockFile are using when you need to spread different regions within one file between two processes.
And in my situation I need to create the scheme where two processes can access one whole file. Consistently or in parallel. That's why I asked about checking the state of file, because as far as I understand it's the easiest way to create this scheme.
09/24/2011 (12:49 am)
I have two applications trying to access one .jpg file: one Win32 app writes (and rewrites) this file (about 9-25 times in minute) and Torque app reads it with the same frequency.Thank you for the links, I read it. But I suppose that there it's another situation: functions LockFile and UnlockFile are using when you need to spread different regions within one file between two processes.
And in my situation I need to create the scheme where two processes can access one whole file. Consistently or in parallel. That's why I asked about checking the state of file, because as far as I understand it's the easiest way to create this scheme.
Torque 3D Owner Ted Southard