having problems reading STDIN
in the following code ---
#(not *exactly*, but this will some idea of what is going on)
binmode(STDIN);
binmode(STDOUT);
binmode(STDERR);
while(<STDIN>)
{
read STDIN, $buffer, 4096, length($buffer);
# do some tests on $buffer
# if i want to write it all $write = $buffer
# if i only want to write part of it, $write = (what i want to
write)
# and $buffer = (what i want to add the next read to)
# set $close_newfile = 1 if i'm done writing
unless ($file_is_open)
{
open (NEWFILE, ">$path_to_file") || &handle_error;
binmode(NEWFILE);
$file_is_open = 1;
}
print NEWFILE "$write" if $file_is_open;
close(NEWFILE) if $close_newfile;
Quote:
}
--- i am having problems getting all of the STDIN. specifically, the read
STDIN doesn't pick up where it stopped reading -- it picks up *well beyond*
the last read position. i can use 'tell' and 'seek' to fix this problem on
a UNIX based system, but the fix doesn't work on my local (win98) win32
setup, so i'm back where i started. why does the file pointer get moved
around? if i read the whole STDIN at once, i have no problems, but the
STDIN may be very large, so i need to use a buffer to process the STDIN.
shouldn't the file pointer stay where i left it from the last read, or is
the observed behavior normal? or are there things that might inadvertently
cause STDIN's file pointer to be moved forward (like other file operations)?
any suggestions on how to glue the filepointer in place would be
appreciated.
tia,
brent