would be nice to have a flag for OpenFile to open files with nonexclusive write access.
this would enable us to write our own multi-access database systems.
http://www.purebasic.fr/english/viewtop ... 13&t=41273
#PB_File_NonExclusive = -1
#PB_File_Exclusive = 0
OpenFile(#File, FileName$ [, AccessFlag = #PB_File_Exclusive ] )
Flag for OpenFile: #PB_File_NonExclusive
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
Flag for OpenFile: #PB_File_NonExclusive
oh... and have a nice day.
Re: Flag for OpenFile: #PB_File_NonExclusive
Doesn't write access require exclusive access? ReadFile won't lock it, I think. It's only when you want to open a file for writing more than once that it locks.
I haven't tried it so I'm talking off the top of my head. But this is how I think it works.
I haven't tried it so I'm talking off the top of my head. But this is how I think it works.
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
Re: Flag for OpenFile: #PB_File_NonExclusive
this is correct, that's how it is now.
I don't know if it is even possible to grant multiple write access.
but if it was possible, I wish we could use it.
if the OS would not allow it, this request is pointless and can be closed.
I don't know if it is even possible to grant multiple write access.
but if it was possible, I wish we could use it.
if the OS would not allow it, this request is pointless and can be closed.
oh... and have a nice day.
Re: Flag for OpenFile: #PB_File_NonExclusive
I use this all the time with my web browser when downloading mp3 files. I open them in Winamp before they are completely downloaded. So this is definetely possible.
Also this is one of the reasons I really HATE Firefox, it gives downloaded files a different file extension until they are completely downloaded, when it renames them. Of course this makes it inconvenient to open them in the correct program in the first place, and when the download is completed you have to open them again.
Also this is one of the reasons I really HATE Firefox, it gives downloaded files a different file extension until they are completely downloaded, when it renames them. Of course this makes it inconvenient to open them in the correct program in the first place, and when the download is completed you have to open them again.
-
- Enthusiast
- Posts: 469
- Joined: Sun Mar 16, 2008 9:18 am
Re: Flag for OpenFile: #PB_File_NonExclusive
That's a safety feature. If you open an incomplete file, it can cause buffer overflows and other problems. I recall seeing that as an Internet Explorer exploit, which is just another reason why FF is safer than IE.Trond wrote:it gives downloaded files a different file extension until they are completely downloaded
Re: Flag for OpenFile: #PB_File_NonExclusive
It is possible under Windows, no problem. Just not with PureBasic's OpenFile().Kaeru Gaman wrote:this is correct, that's how it is now.
I don't know if it is even possible to grant multiple write access.
but if it was possible, I wish we could use it.
if the OS would not allow it, this request is pointless and can be closed.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )