Microsoft KB Archive/42550

= Use Long Integer with PEEK, PEEKW, and PEEKL; SINGLE Can Fail =

Article ID: 42550

Article Last Modified on 1/9/2003

-

APPLIES TO


 * Microsoft QuickBasic Compiler for Macintosh 1.0

-



This article was previously published under Q42550



SUMMARY
Microsoft QuickBASIC for the Macintosh allows for the contents of memory locations to be assigned to variables with the PEEK, PEEKW, or PEEKL functions. PEEK returns one byte of information, PEEKW returns one word (two bytes) of information, and PEEKL returns a double word (four bytes).

The variable used to store a memory address should be of type long integer.

If memory addresses are stored in SINGLE precision numbers, it is possible (if the address is large enough) to lose one or more digits. A SINGLE precision number may not be able to store memory addresses that are sufficiently large (such as FFFFFF Hex). A DOUBLE precision number has the capacity to represent high memory addresses, but rounding or truncation may occur (as it also does in single precision) because of the IEEE internal representation of floating-point numbers. This will not be a problem with LONG integers.



MORE INFORMATION
There are two methods in Macintosh QuickBASIC to make a variable with a type of long integer:


 * 1) DEFLNG J-M defines variables beginning with letters J through M as long integer. DEFLNG A-Z makes all variables default to long integer.
 * 2) Appending the &quot;&&quot; character to a variable makes it long integer. This explicit typing overrides DEFSNG, DEFDBL, and DEFINT.

Additional query words: MQuickB

Keywords: KB42550

-

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

© Microsoft Corporation. All rights reserved.