[solved] Reading a file that is used by another program.

Just starting out? Need help? Post your questions and find answers here.
coldhands
New User
New User
Posts: 5
Joined: Sat Jul 31, 2010 10:14 pm

[solved] Reading a file that is used by another program.

Post 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.
Last edited by coldhands on Mon Jan 31, 2011 12:37 pm, edited 1 time in total.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: Reading a file that is used by another program.

Post 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.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
coldhands
New User
New User
Posts: 5
Joined: Sat Jul 31, 2010 10:14 pm

Re: Reading a file that is used by another program.

Post 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 :D
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.
Suirad
User
User
Posts: 42
Joined: Sun Sep 20, 2009 7:37 pm
Location: Melbourne, Florida, USA

Re: Reading a file that is used by another program.

Post 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 :wink:
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: [solved] Reading a file that is used by another program.

Post by Rook Zimbabwe »

That does sound EXTREMELY cool! I am thinking API may be the only way to do that too!
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Post Reply