file read write wait

ssrikant
05-15-2003, 04:15 PM
I have my part of application that reads a file to wait for other part of application that writes so that i have valid data to be retrieved how could i wait for something like that
-srikant

ALEX_0077
05-15-2003, 06:38 PM
Since VB goes line by line, have it read first, then write:


Private Sub DoWork_DangIt()
Dim bReading as Boolean
Dim bWritting as Boolean

Do while bReading = true

'Read!
'If you are done reading, make bReading = False !
doEvents
Loop

Do while bWritting = true

'Write!

'If you are done writting, make bWritting = false

doEvents
Loop
End Sub

ssrikant
05-17-2003, 12:41 PM
I would have done that by now had it been that simple the problem is there are two timers which get activated simultaneously one to read and toher to write .
-srikant

ALEX_0077
05-17-2003, 05:15 PM
Then why use timers? You cant expect to have a safe read and write unless you know what to read first to see were and what you can write. Event the Timers don't actually go off at the exact same time. Windows is 'Multi-tasking' only because it goes from one task to the next so quickly, unlike an OS such as LINUX (unix core), wich is a TRUE multitasking OS. So just read first, then write. Its safer, more reliable, and is way easier and efficient than two timers.

MindGenius
05-18-2003, 01:58 AM
I don't see the point of using timers... unless you had to write something a lot of time after you read it... :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum