Results 1 to 5 of 5

Thread: Need help with file access

  1. #1
    Guest

    Angry

    Hello all,

    I am working on a project that requires me to read in a file from the hard disk and determine common patterns. to do this I need to "see" the binary in 32 bit chunks. does anyone know of a simple way to do this? Any help will be appreciated and mentioned in the program. Thanks

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Check out my post on a similar topic.

    Binary File Access
    Iain, thats with an i by the way!

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    32 bit chunks can't be easier than this:
    Code:
    Dim chunks() as long
    Open File for binary as #1
       get #1,,chunks
    close 1
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    Guest

    Talking That helps some.

    Thanks guy's. that helps some.But......

    What I really need to know is how to read the file in as chunks and then compare the chunks to a "database" (a list of the possible combonations of 1's and 0'(on's and off's) in a 32 bit chunk) so I can assign a code number to each chunk. I should be able to figure out most of that. I just need to make sure that reading in the file as binary will allow me to see the bits in the chunk. Also, a tricky bit that's bothering me is how to assign the last chunk a code if it's not 32 bits long. Any suggestions?


    After I posted this I tried your code kedaman.

    I recieved an error 458. I haven't gotten the sp4 downloaded yet. this may be the cause.

    [Edited by Technowizard on 09-18-2000 at 10:19 PM]

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    If the last chunk is 8 bit for instance, it will add up extra 0 bit's to the last long integer.
    you could have a look at my (not yet complete) file tutorial:
    http://www.geocities.com/kedasu/kedamans_file.htm
    There should be a section about how data is stored binary, and look at integer, since longinteger is stored the same way except with 16 bit extra.

    To get a bit from a long integer you could probably do something like this:
    Code:
    yourbit = cbool(lng and bit)
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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