I'm trying to read a growing file with the following code:
use IO::Handle;
$file = $ARGV[0];
open(INFILE,"< $file");
while(1)
{
while(<INFILE>)
{
print("$_");
sleep(5);
}
INFILE->clearerr();
}
In order to test it, I've been doing an echo abc >> test.log from the dos prompt on NT. This works just fine and my script prints out the new line with "abc" on it.
When I open notepad, wordpad or gvim and try to write to the file, it fails and says the file is in use by another process.
Any ideas why it would be locked for writes when I opened it in read only mode?
This is my first post so don't hurt me!!! :)
Thanks...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.