Page 1 of 1
[solved] Reading a file that is used by another program.
Posted: Sun Jan 30, 2011 10:01 pm
by coldhands
Is it somehow possible to read a file that is currently being written by another program? ReadFile/OpenFile will always return 0 but opening the file with notepad works fine.
Re: Reading a file that is used by another program.
Posted: Mon Jan 31, 2011 5:32 am
by Rook Zimbabwe
what type of file?
The reason this ia asked is: If it is a DB file maybe the answer wold be NO... if it is a TXT file you shouldn't have any issues... itis going to depend on the type of file and access rights for that file depending on windows version etc.
Re: Reading a file that is used by another program.
Posted: Mon Jan 31, 2011 12:14 pm
by coldhands
I solved the problem using WinAPI functions for file access, as described in
http://www.purebasic.fr/english/viewtop ... 13&t=41197. Thanks to mk-soft

About the files: They're Age of Empires 2 Recorded Games. I'm streaming them from one computer to another live as they're being created, simulating a spectators mode for the game.
Re: Reading a file that is used by another program.
Posted: Mon Jan 31, 2011 3:23 pm
by Suirad
coldhands wrote:About the files: They're Age of Empires 2 Recorded Games. I'm streaming them from one computer to another live as they're being created, simulating a spectators mode for the game.
nice. that would be something worth sharing

Re: [solved] Reading a file that is used by another program.
Posted: Mon Jan 31, 2011 4:17 pm
by Rook Zimbabwe
That does sound EXTREMELY cool! I am thinking API may be the only way to do that too!