Results 1 to 24 of 24

Thread: Merging 2 bytes to make an integer (Resolved)

Threaded View

  1. #1

    Thread Starter
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176

    Resolved Merging 2 bytes to make an integer (Resolved)

    Hello,

    If I load all file details into a binary array how would I convert two of those binary entries into an integer or long?

    e.g

    VB Code:
    1. Dim FileBinary() as byte
    2.     Dim intFile as integer
    3.     Dim intTest as integer
    4.  
    5.     'Read in the whole file to a binary array
    6.     intFile = FreeFile
    7.     ReDim FileBinary(Len(Filename))
    8.     Open Filename For Binary Access Read As intFile Len = 1
    9.         Get intFile, 1, FileBinary
    10.     Close intFile
    11.  
    12.     'How do I now read the first two elements as though they were an integer
    13.     intTest = FileBinary(0) & Filebinary(1) 'doesnt work

    I hope this makes sense. The application I am writting reads in a third part file and needs to be read in as bytes so that I can process the file correctly. i cant therefore load in the value straight to an integer as I dont actually know its an integer until I have the file information.
    Last edited by BodwadUK; Jun 6th, 2006 at 04:08 AM.
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width