Microsoft KB Archive/27097

= How to Obtain Upper and Lower Bytes of an Integer =

Article ID: 27097

Article Last Modified on 8/16/2005

-

APPLIES TO


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

-



This article was previously published under Q27097



SUMMARY
The program listed below demonstrates how to obtain the upper and lower bytes of an integer. The following is sample code:

Example
' To try this example in VBDOS.EXE: ' 1. From the File menu, choose New Project. ' 2. Copy the code example to the Code window. ' 3. Press F5 to run the program. CLS a% = &HA0B0 ah% = (a% AND &HFF00) \ 256 AND &HFF  ' Note: &quot;\&quot; means integer division al% = a% AND &HFF PRINT HEX$(ah%)                ' Prints high bytes: A0 PRINT HEX$(al%)                 ' Prints low bytes: B0

Additional query words: VBmsdos QuickBas BasicCom

Keywords: KB27097

-

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

© Microsoft Corporation. All rights reserved.