View previous topic :: View next topic |
Author |
Message |
Hooligan VDS Developer
Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Wed Feb 22, 2017 12:41 am Post subject: Open a file while it is already open. |
|
|
I am trying to create a script that opens a file as read only that is created by another program that is writing that file from a USB stream. I know that the file is not locked because I can open it with notepad while it is streaming.
I have had no luck with "List loadfile" or "@new(File,filename,READ)". Anyone have any ideas or tricks? _________________ Hooligan
Why be normal? |
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1562
|
Posted: Wed Feb 22, 2017 1:56 am Post subject: |
|
|
Sorry I don't have code for you in VDS but maybe some clues to help you progress through this.
You need to use the OpenFile windows api:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365430(v=vs.85).aspx
and pass the OF_READ parameter, so it opens it in readonly mode. I'm guessing that is what Windows Notepad is doing to allow you to open/read the file. |
|
Back to top |
|
|
nickos Valued Newbie
Joined: 17 Mar 2007 Posts: 26
|
Posted: Wed Feb 22, 2017 8:57 am Post subject: Re: Open a file while it is already open. |
|
|
Hooligan wrote: | I am trying to create a script that opens a file as read only that is created by another program that is writing that file from a USB stream. I know that the file is not locked because I can open it with notepad while it is streaming.
I have had no luck with "List loadfile" or "@new(File,filename,READ)". Anyone have any ideas or tricks? |
Maybe it just kinda busy file, have you tried to put in a loop?
Code: |
list clear,(list)
while @zero(@count(list))
list loadfile,(list),etc.txt
wait 0.1
wend |
|
|
Back to top |
|
|
Hooligan VDS Developer
Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Wed Feb 22, 2017 4:22 pm Post subject: |
|
|
I have tried looping it... It updates a 80byte burst every second. Not very busy...
I'll try PGWare's suggestion. I assumed that was the call @new used.... _________________ Hooligan
Why be normal? |
|
Back to top |
|
|
|