Two programs - Same file Instantaneous write and read.
-
Can someone suggest a method to accomplish writing to a file and at that moment another program would read that same data for its use. The program is writing a line of floats to just generate data while the other program needs to read and process it. Using two seperate executables and an ascii file led to apparent file locking issues. Thanks for any suggestions. Ken
-
Can someone suggest a method to accomplish writing to a file and at that moment another program would read that same data for its use. The program is writing a line of floats to just generate data while the other program needs to read and process it. Using two seperate executables and an ascii file led to apparent file locking issues. Thanks for any suggestions. Ken
A file isn't the most reliable way to transfer data between apps. From your description, a socket would be a better way. And in any event, you'd still need some IPC to let the second app know that there's data to be read --Mike-- THERE IS NO THERE IS NO BUT THERE IS MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me
-
Can someone suggest a method to accomplish writing to a file and at that moment another program would read that same data for its use. The program is writing a line of floats to just generate data while the other program needs to read and process it. Using two seperate executables and an ascii file led to apparent file locking issues. Thanks for any suggestions. Ken
You can do this with a memory mapped file and a named event. Create a named event and open it in both applications. Set it in one thread to signal that the other can read the data. When the data is read reset the event. http://www.codeproject.com/win32/cmemmap.asp[^] John
-
You can do this with a memory mapped file and a named event. Create a named event and open it in both applications. Set it in one thread to signal that the other can read the data. When the data is read reset the event. http://www.codeproject.com/win32/cmemmap.asp[^] John
-
Can someone suggest a method to accomplish writing to a file and at that moment another program would read that same data for its use. The program is writing a line of floats to just generate data while the other program needs to read and process it. Using two seperate executables and an ascii file led to apparent file locking issues. Thanks for any suggestions. Ken
Use an “event” — a synchronization object that allows one thread to notify another that an event has occurred. Events are useful when a thread needs to know when to perform its task. For example, a thread that copies data to a data archive would need to be notified when new data is available. Look for CreateEvent(), SetEvent(), WaitForSingleObject(), etc.