Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!news.cgarbs.de!news.addix.net!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail From: "Theo Tress" Newsgroups: comp.lang.basic.visual.misc Subject: Re: EOF Marker Date: Fri, 20 Jan 2012 17:45:46 +0100 Organization: 1&1 Internet AG Lines: 31 Message-ID: References: NNTP-Posting-Host: dslb-094-217-081-120.pools.arcor-ip.net Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Trace: online.de 1327078011 2960 94.217.81.120 (20 Jan 2012 16:46:51 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Fri, 20 Jan 2012 16:46:51 +0000 (UTC) In-Reply-To: X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6002.18197 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18463 Xref: x330-a1.tempe.blueboxinc.net comp.lang.basic.visual.misc:710 > Got a bit of code that reads a text file, looks something like this: > > Open FilePath For Input As #FileNum > Do Until EOF(FileNum) > Line Input #FileNum, LineStr > DoSomething > Loop > Close #FileNum Text lines om a.txt file usually are separated by a two byte sequence CR-LF = carriage return - linefeed = cgr$(13) chr$(10) and the end of such a file is indicated by am EOF character - chr$(26). Basic's Line Input reads until such a CR/LF sequence is encountered, and sets EOF to true if an EOF char occurs. So if yo try to read a file including control characters and binary data (and not plain text) there is a good chance that your program encounters an EOF char and stops reading. If that's your problem then you must do a binary read (OPEN ... FOR BINARY ...)providing an input buffer of fixed length and check the CR/LF yourself. If a CR/LF occurs you can shorten the buffer and start next reading behind the CR/LF position else you have to read one more buffer. Doing this, you can also read (and write) 'behind' the EOF char easily. HTH rokas