Microsoft KB Archive/65396

= EOF in 7.00 Returns &quot;Nonzero&quot; for TRUE, But 4.50 Returns -1 =

Article ID: 65396

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS

-



This article was previously published under Q65396



SUMMARY
The EOF function has changed slightly from QuickBasic versions 4.50 and earlier to Microsoft Basic Professional Development System (PDS) versions 7.00 and later. In QuickBasic, the EOF function will return 0 (zero) for FALSE and -1 for TRUE. In Basic PDS 7.00, EOF still returns 0 for FALSE, but it returns &quot;nonzero&quot; for TRUE. This means that EOF will return a positive or negative number other than 0 if the end of the file has been reached or if you are at the &quot;end&quot; of an ISAM table. Previous QuickBasic programs that hard coded a check for -1 will have to be changed to check for a nonzero value. Since 0 is equivalent to FALSE and nonzero evaluates to TRUE in Basic, this is an easy change to make. For example, you do not need to check &quot;IF EOF = -1 THEN GOSUB mysub&quot;; instead, you can use &quot;IF EOF THEN GOSUB mysub&quot;. This second check will work in any version of Microsoft Basic.

Additional query words: QuickBas BasicCom

Keywords: KB65396

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.