EOF in 7.00 Returns "Nonzero" for TRUE, But 4.50 Returns -1 (65396)
The information in this article applies to:
- Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
- Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.1
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
- Microsoft QuickBASIC 4.0
- Microsoft QuickBASIC 4.0b
- Microsoft QuickBASIC 4.5
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 "nonzero" 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 "end" 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 "IF EOF = -1 THEN
GOSUB mysub"; instead, you can use "IF EOF THEN GOSUB mysub". This second
check will work in any version of Microsoft Basic.
Modification Type: | Minor | Last Reviewed: | 8/16/2005 |
---|
Keywords: | KB65396 |
---|
|