Re: File Handle Reading Blues: Rereading a File Handle for Input

From: Joe Smith (Joe.Smith_at_inwap.com)
Date: 07/22/04


Date: Thu, 22 Jul 2004 10:02:30 GMT

Dietrich wrote:

> 18 print INVARS_NW <INVARS_READ>;

That reads the entire contents of the input file, all the way to the
end of the file, and sends it to the output. Once you've read
all the way to EOF, you cannot read anymore. Either close and
re-open the input file, or learn how to use the seek() function.
        -Joe

P.S. Next time, post to comp.lang.perl.misc and not here (comp.lang.perl).



Relevant Pages

  • Re: How to read a char at a time?
    ... But the input file is binary and may contain null characters. ... The getchar() man page says: "getcharreturns the character read as an ... unsigned char cast to an int or EOF on end of file or error." ...
    (comp.unix.programmer)
  • Re: Determining EOF using fseek()?
    ... >> The second method could loop forever if run on an input file that ... The fgetccall fails and returns EOF. ... the EOF return "because the attempt to read from the input file is ... The loop that tests for ...
    (comp.lang.c)
  • Re: How to read a char at a time?
    ... But the input file is binary and may contain null characters. ... unsigned char cast to an int or EOF on end of file or error." ... Note that it says "unsigned char". ...
    (comp.unix.programmer)
  • Re: Regular Expressions Insert
    ... In psuedocode ... open the input file ... open the output file ... While not EOF ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: strace on cat /proc/my_file gives results by calling read twice why?
    ... second one indicates that EOF has been reached by returning 0. ... call can't do both of those things, so cat needs to do 2 reads. ... Only if the input file ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)