Re: Input past end of file

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: John Nurick (j.mapSoN.nurick_at_dial.pipex.com)
Date: 09/07/04


Date: Tue, 07 Sep 2004 06:32:49 +0100

Hi Quang,

The first thing I'd try is using the FileSystemObject object and opening
the file as a TextStream rather than a binary file. Use
TextStream.ReadLine to read lines.

Otherwise, its necessary to know more about your file, the "binary
characters" it contains, and what you want to happen to them. If it's
possible for the "binary characters" to include CRLF pairs that do not
signal linebreaks you will certainly have to write custom code to parse
the file.

On Mon, 6 Sep 2004 18:27:01 -0700, Tran Hong Quang
<TranHongQuang@discussions.microsoft.com> wrote:

>Hi,
> I have following code:
>
>Open strFileName For Binary Access Read Shared As intInputFileHandler
>While (Not EOF(intInputFileHandler)
> Line Input #intInputFileHandler, strBuff 'Read one line
> ..................
> ..................
>
>Wend
>
>It always read over the end of file. The error message is "Input past end of
>file"
>
>If I change open mode like this:
>Open strFileName For Input Shared As intInputFileHandler
>
>It won't read over the end of file anymore. But the input file isn't 100%
>text file, sometime it has binary characters. Thus reading process may stop
>before it reach the end of file because it find EOF character inside the file.
>
>So, if the input file has multiple lines, but sometime it can have binary
>characters, what is the best way to open and read the whole file line by line
>?
>
>Thanks
>Quang

--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.


Relevant Pages

  • Input past end of file
    ... Open strFileName For Binary Access Read Shared As intInputFileHandler ... sometime it has binary characters. ... So, if the input file has multiple lines, but sometime it can have binary ...
    (microsoft.public.access.modulesdaovba)
  • Side-effecting input FD logical record hazardous?
    ... logical record in the FD area for a variable-length ... Characters beyond the length just READ, ... input file I desired to clean up "on the fly", ... I tried doing a READ INTO into a Working-Storage ...
    (comp.lang.cobol)
  • Re: basic python questions
    ... exceptions. ... Do you want the program to continue if you have no input file? ... create a string of all the characters that you consider as valid in ... the string. ...
    (comp.lang.python)
  • Re: postscript terminal - how to typeset a unicode character (correct syntax)?
    ... The help system says that one can request Unicode ... characters by setting "set encoding utf8". ... pass it to the postscript terminal by adding to the 'set term postscript' ... that is what has happened to your input file. ...
    (comp.graphics.apps.gnuplot)
  • Re: Doing Neat Tables Blind: Wrapping, Placement and Appearance?
    ... It may not be a paragraph gramatically, but it is formatted as one ... Can this second thing be converted to characters to make easier picture ... When I said "not the input file" I meant to say that the name of the ... later or sometimes even earlier than a reference to it. ...
    (comp.text.tex)